From nobody Wed Sep 4 15:53:52 2024 X-Original-To: dev-commits-src-branches@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 4WzRqh5rV6z5V83Z; Wed, 04 Sep 2024 15:53:52 +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 4WzRqh35Txz4Vnq; Wed, 4 Sep 2024 15:53:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725465232; 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=TRRGkfpeGdjhwjHPXD1z209J9bWCOMESmr4TZOTdhyI=; b=radhar+eIwpJbuB6Eg7ac1lpqDJo92iHBbNkz5ILynQxTiMrH8VSWzl6FeOM3HAJ0rNpC0 TTyE/L73vehBFDuRue5jZ7PbC/nFa9yAfH5U1zzWpdMjX8Ofvr3x+hZ1eNlizq1BUfpHcK BZNTvh3q1IU2tXEpnMx6gXq6sD6j3qdXciHOk4l5AzPctbyPMp4h3FC8rU9rntT2X5FPl4 s9i9BO/YYMZu0eEP/0J85Hv4l81pFmMI3T0PPAtpeKzWDLAxpzJU4ufKmdpJP7JxneoaLV 8efoWDlGAWVJIhDv23IUEQhT0dheR9oRENuJz8M314xRdiSGepOf4c5pkF+Gvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725465232; a=rsa-sha256; cv=none; b=sMh3/VjqifsACgt+GMQdbB0qRg31A6pCbd4BQM6wv399i8OSCJTUTrycjcV1bOxYuxgTiT 7V/y3zqnz6dDDmuL6cgKGW4UqhHFEesWniuDWwvmujl4/TPjoIAf3ZOY2MGb3C+uFI2J2e 8cUUU2GOpKrs0rk+MiQZ6AdH4/gbk9TWZqJ1JxH/Yu/tAWiyGTmw92ukIvyRiJapa39tnp waeZFcaVh3fL2rss/a2JQGNxjlBTzROihVeDZZkjAK5A/5WpPRgCWc9zqptK8hlrGYvg0G kWJLMDhvbTDqBK7brrzeEV5ngCyh2Ssd6LvbJANOKpJJ6VuFrb0zm/z2p7vDIA== 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=1725465232; 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=TRRGkfpeGdjhwjHPXD1z209J9bWCOMESmr4TZOTdhyI=; b=ajovilMO7T7Dn3MY2RyeXJ8QV5tSQvxNLvCqDTs4JLufde+HJMEQ1uSA2aSNfxTGnAjre3 bmBC51mpPZwmRHfNJz/D/MNSoPNKIEaF+WG/U9x9fg+6a9kq2wTccl204ZM5823Cbn8SmA /T693fAi5TS9GsiRFPswK8WZt/6v4jNIAZjwRdjlFmAeNvlNTuw/k6G4QeCPW9QWfEjAi0 b+A5FozYMOHoiU3r3fT5HVePwjFdcVvJPt3ywIq5ifp0VpD2syAEJnY8JnVtJ4q9qoM/nN 5yTHqf9J5cFXy/ovLgqjRmgerUdipamJS3QFAmGASaviaxT4Hcrl6LmS8SnOWg== 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 4WzRqh2hfGzX36; Wed, 4 Sep 2024 15:53:52 +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 484Frqm3019809; Wed, 4 Sep 2024 15:53:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 484FrqCQ019806; Wed, 4 Sep 2024 15:53:52 GMT (envelope-from git) Date: Wed, 4 Sep 2024 15:53:52 GMT Message-Id: <202409041553.484FrqCQ019806@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: b13631a59f2a - stable/13 - ctl: fix memory disclosure in read/write buffer commands List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: b13631a59f2a303418c0f3f298b33f2a51fa59a7 Auto-Submitted: auto-generated The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b13631a59f2a303418c0f3f298b33f2a51fa59a7 commit b13631a59f2a303418c0f3f298b33f2a51fa59a7 Author: Pierre Pronchery AuthorDate: 2024-09-04 14:38:11 +0000 Commit: Ed Maste CommitDate: 2024-09-04 15:52:06 +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 (cherry picked from commit ea44766b78d639d3a89afd5302ec6feffaade813) (cherry picked from commit cdfdb3b0086268cdc365174ebfb69e66b5dde0b5) --- 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 5635246845b9..f9fec62249cb 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -5633,7 +5633,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; } @@ -5674,7 +5674,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); } /*