From nobody Wed Sep 04 20:29:42 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 4WzYxz0M1sz5VKkQ; Wed, 04 Sep 2024 20:29:43 +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 4WzYxy6ccTz4JMh; Wed, 4 Sep 2024 20:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725481782; 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=JEeh8BfvAjspiBnMmHAjzI5IFOzMtADERljdwQcCeOo=; b=iTKA61h+fOuTv9iVSK5x9ufUNgc5IRc+VAiHh7IqxK2ZdlnAWOWiVt6kmN80DxYrEbcdWl oNkHjz68Z8U4TCzqSLcVBemwb49Ujh7nMQhYxTVvX/cqOptMp1x8hk2A883t0nApckf2mC zZowAplD3q+7mH79KfQ8ePwwfUMKoYPxDhnVfvKsnoR0/jWSx7rySxhH6ICv5byzj+kH49 DVcNEP9ILRcEQXf0UiXJ82NzXm7XZmIQdhbBYYgDCFXi0ZRyaTdaZNdfq67tVVIRtAAHBY zEyfN2c3EiqgV31ZJdp0btrZiPexdZpbo39JiCOxGYB72HCzeDgLGZUdskZdPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725481782; a=rsa-sha256; cv=none; b=gPJPucvggyEKpE+6P/O8F4VQ7HXhBte2odZGYdm9HDKebJTjkIVISXnV88tW9OGDBBWHX1 0zrL1hUtjkxG0Zm+g22wzgxMk2fV5w+MDZ9i77yg6MxM4V+TbhxbOgxo7GRcl2kYLW9Sd4 JuQvlOxG/IiDcqIyGQBXdZUMkTHAuqG+CL6Ay51dokEZnLGfVvj0iojvIco+jFYw/QbWrf JLNyF4Ou8tk8nIBW2I3LH9D2qc3WK1dWhVxd9Ae36DxsymrP5o/vQHIEKZn7Frqk80D0Br W7mIamHAfMCOROPbgaoanCFOBTOZxo2nBtjmfMpOL6Q1TBrFU0Saz7i02p9cfw== 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=1725481782; 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=JEeh8BfvAjspiBnMmHAjzI5IFOzMtADERljdwQcCeOo=; b=aICJrjYbgnQKGR969O0efZh76OIA6wf2ZqIjWOHZFwbYatwHHXwLJEYgAo2ZqvlbISpKDG V4CpLjpbgJ4p40uO3TJcS3QkL4tJKQahh+4hsfJ4WuFy/WfHn1VooifRoba7aEwphFrE0t 0dyZlo6bfEnV26503Xsd6bCJ9gPEgA0/c5dGGPO0JD3gtaZiHO0XRWuAIfTMRlug5VAiLp ujDju45NLhR4VuC0wb+Z9JQxOr21UOlkZ3YcFeUohteKKfo/nD0HMWEJ0qx0UYHbSXs4RH 1a9jKEIrDSPxkQ5JbNcG7H5CIApNg+hu+BWq7OXJq71b8VK0IaxPhBxnUdESrg== 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 4WzYxy5w29zfgk; Wed, 4 Sep 2024 20:29:42 +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 484KTgqi082596; Wed, 4 Sep 2024 20:29:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 484KTg3j082593; Wed, 4 Sep 2024 20:29:42 GMT (envelope-from git) Date: Wed, 4 Sep 2024 20:29:42 GMT Message-Id: <202409042029.484KTg3j082593@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: 4752a984dc07 - releng/13.3 - 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/13.3 X-Git-Reftype: branch X-Git-Commit: 4752a984dc07e2e4a1dfdf4579dc249b04716b73 Auto-Submitted: auto-generated The branch releng/13.3 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=4752a984dc07e2e4a1dfdf4579dc249b04716b73 commit 4752a984dc07e2e4a1dfdf4579dc249b04716b73 Author: Pierre Pronchery AuthorDate: 2024-09-04 14:38:11 +0000 Commit: Ed Maste CommitDate: 2024-09-04 20:29:07 +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) (cherry picked from commit b13631a59f2a303418c0f3f298b33f2a51fa59a7) 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 92eb658b2d2d..6fbe6bc5a484 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); } /*