From nobody Wed Sep 04 14:46:17 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WzQKj5YQFz5V2qc; Wed, 04 Sep 2024 14:46:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WzQKj56nKz4GMW; Wed, 4 Sep 2024 14:46:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725461177; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xMD97kITUYdyZ1ge0Zkq13FoZrh+QxhS+aqsyCQmxqE=; b=otXLGOmQyvReg6w4rcRrHhDJ5+vK49GyE5gBCaW3AE6vrLcdbiHzDXfdHymn3O5jmfIzvI Yg4+WMe+fHtODW+Laiu9dYYESwUym5NRW4Jr2uZEt4z3nmu79hF4qc3UBPd61TCZf2BU5E /HB6f9p3lbjSoZOVaPPYs1Q7As1esFqc2BvHbcCpAnotC2XzmcDvpaCno5ujCQVxLrg2KN +kI6KS9Klc0tvur35X9YLRimudqsuh4kddoP7U6tKYamJJh6GNRWoKx7lkg9TKjS+ggrY4 jQ9DCQallHmYOMo1CmJzELAL8Vgk90xJ68RpUWKq9OVTPcHC4SO2Cz6AkPKWiA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725461177; a=rsa-sha256; cv=none; b=Xzt5jul4ZiTsVavRq8RJ8b5M8n6am8YafFmJH5vgXUD7MxVZm8KNQ29biGytfLaJP+lCPR b89Jp5JHVrJsGhnOfC8wy0k/3yHvrqb8ETKKoFQ4/1YA+cOGRu3Wj8+NSpFacKBD6G3anN WL9okW27rHrkElj+uIHNy3R1aS3XyES/Wiem59scRg6U2R9DgnsiGQOxSrSp86j60fdXRk ectbwS5n3xU8cUir1Frm2dPpwo7OCBP+1h37mjIWSq3fW7f01IwRL+5JZdy7S2G+V+wjbj fAdiVHuGtG6c8O1IinMA2d1XsBDSQXGTRDd+FGaTcIxAtY/O+yHjbfIkOTiNLQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725461177; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xMD97kITUYdyZ1ge0Zkq13FoZrh+QxhS+aqsyCQmxqE=; b=WrPNcSdkvl/LyhXICVqkx18sRcIqFTRytvPdWFbmLqGJj/J1gOiK7Gw4B5RSsbS0TjLKuf 9kwFk5BppvnVb2S2PDvKW5fppdmQLryRP0y5lyj+bEVQtT/o1kOXQo8YDmF+nqvEh7WK2r 9lIHIHlGP4t7lWeBWicSUguU/hiRPwN78zqKXCN2SflskIaz2UyvWDEbUcZHRuynII4o50 nC/aAZTLuxtdz/qor8J1BCX5rFccnfyysg5eJ+dLrg8n2aHe3NuwDfiKQlb6aPDOvo2zen zXHDNfTX5eoYXVXoRe4pO8F3A6gGkqmQctKfX6lw1UTzrhhlV0ablrcVgk5fRw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WzQKj4gF5zSp9; Wed, 4 Sep 2024 14:46:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 484EkHl1000778; Wed, 4 Sep 2024 14:46:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 484EkH57000775; Wed, 4 Sep 2024 14:46:17 GMT (envelope-from git) Date: Wed, 4 Sep 2024 14:46:17 GMT Message-Id: <202409041446.484EkH57000775@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: ea44766b78d6 - main - ctl: fix memory disclosure in read/write buffer commands List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ea44766b78d639d3a89afd5302ec6feffaade813 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ea44766b78d639d3a89afd5302ec6feffaade813 commit ea44766b78d639d3a89afd5302ec6feffaade813 Author: Pierre Pronchery AuthorDate: 2024-09-04 14:38:11 +0000 Commit: Ed Maste CommitDate: 2024-09-04 14:38:11 +0000 ctl: fix memory disclosure in read/write buffer commands The functions ctl_write_buffer() and ctl_read_buffer() are vulnerable to a kernel memory disclosure caused by an uninitialized kernel allocation. If one of these functions is called for the first time for a given LUN, a kernel allocation is performed without the M_ZERO flag. Then a call to ctl_read_buffer() returns the content of this allocation, which may contain kernel data. Reported by: Synacktiv Reviewed by: asomers Reviewed by: jhb Security: FreeBSD-SA-24:11.ctl Security: CVE-2024-8178 Security: HYP-05 Sponsored by: The Alpha-Omega Project Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45952 --- sys/cam/ctl/ctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 2124903f4ac1..e58299951540 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -5586,7 +5586,7 @@ ctl_read_buffer(struct ctl_scsiio *ctsio) } else { if (lun->write_buffer == NULL) { lun->write_buffer = malloc(CTL_WRITE_BUFFER_SIZE, - M_CTL, M_WAITOK); + M_CTL, M_WAITOK | M_ZERO); } ctsio->kern_data_ptr = lun->write_buffer + buffer_offset; } @@ -5627,7 +5627,7 @@ ctl_write_buffer(struct ctl_scsiio *ctsio) if (lun->write_buffer == NULL) { lun->write_buffer = malloc(CTL_WRITE_BUFFER_SIZE, - M_CTL, M_WAITOK); + M_CTL, M_WAITOK | M_ZERO); } /*