From nobody Wed Sep 04 20:54:15 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 4WzZVJ17Lmz5VMX7; Wed, 04 Sep 2024 20:54:16 +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 4WzZVH6BHkz4Q53; Wed, 4 Sep 2024 20:54:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725483255; 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=Y/XwN6+0MODEiUwqBsFd24/63fttvDz0lV0SnP8RLLE=; b=f+mHP8Vm+xPTyeozdKfkJqb8BnE/CcMrHqQ0R9a+jVVEzswgDhsRVm9vPg0CTLGFewT05n 4+yjPi6aVQA5xOZ6YofJdjVTCnPL6CA1h+bUSqIh9C4rBHqkJt/xsYJTDGyf9AoK34pL2l B07wnZzedx7DtH6wcJnO06qC2q1jgl8fG1Lq6UX6TmRE3+CnC54VjZ5hY3Xw1pnxEvCVD2 Duu783vQBcj6pHvjPiDt+w4GMFn4oaRKXzIMmzPa1rF6jTJ6H/va0rOp2XnTNu1Txqd+iu jNUXQvY2IXdoC/djZz6/XGkIeCkhB93YZFjjh4Mnz8HWuzxBwrV/IwBM9bOAFw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725483255; a=rsa-sha256; cv=none; b=pBWaz6GdTRSOHE696uRzCE7wUDaz0B5V3YIiPeec4C/MQhHeJ1BM0+7zBbQHaCJONs2s3H hjx9JNYfOKxv3bouUDS11NAXZ7waJZk3/wNYkfqaE0VIqTgxuGPi36NC+WGjwZOZ7Kcrio YSRJbWArGfPGRR2HT08o5iafhVvwcSV7LGSPfXz3VzuEoYk8XWGuKex+bJaUOeEV0LKlnB /teaCbc2hvgP95pQwAjDBEbwNd33/0dXV6xZ92s1oX5Wra2BLmwwv4VpM+ZFREc52TLNie Tfrx81ZaGOjavsABLJhdR020Uq5nrnc8sycBqqvMLYWmq2GQhO9GZOax7bbAVA== 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=1725483255; 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=Y/XwN6+0MODEiUwqBsFd24/63fttvDz0lV0SnP8RLLE=; b=bjYlOf+e2nt7+lCRd2qrCG9u2+D0GD14KNVKsdKv6JXdC3deI5SWwEh9aN/1s4oVG4Lkd9 PO/AN0hcOHtOEfyXT32ZZGYBAN7NZ+/xaIfkuOVTY/N9oOBpaggncb4e/flDEhn4X7SwOE c+6gJNG84wvKxmf5+/PEi8QLYSkTz7UcjINqFBH9e7KEKxnUjorVKn1dR6wTx/T5bVc7dJ uup7XWz5T6+3phcZLbGHVZqiwKYQtUthQS/V16s8KiWxqdNRS9a99xH78Zd/y3oYMp+rvO CqN6VbG0mHfu4Lzb7122dCrneFVgL4e7n4e9uxKsYVHxkkOTNwRJBtaS5KqePA== 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 4WzZVH5prBzgYB; Wed, 4 Sep 2024 20:54:15 +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 484KsF8n033835; Wed, 4 Sep 2024 20:54:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 484KsFKi033832; Wed, 4 Sep 2024 20:54:15 GMT (envelope-from git) Date: Wed, 4 Sep 2024 20:54:15 GMT Message-Id: <202409042054.484KsFKi033832@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: f7aa7c38318c - releng/14.0 - 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/releng/14.0 X-Git-Reftype: branch X-Git-Commit: f7aa7c38318c700cc6915b4a48941a6b9a0807c0 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f7aa7c38318c700cc6915b4a48941a6b9a0807c0 commit f7aa7c38318c700cc6915b4a48941a6b9a0807c0 Author: Pierre Pronchery AuthorDate: 2024-09-04 14:38:11 +0000 Commit: Ed Maste CommitDate: 2024-09-04 20:54:02 +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) Approved by: so --- 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 004e86900342..f48fc203b90d 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -5634,7 +5634,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; } @@ -5675,7 +5675,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); } /*