Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F421317D8AB for ; Thu, 30 May 2024 15:10:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717081817; cv=none; b=XZpfPLN7obYZGN2/sTVVYIdEOJEB5dwr9t0c8bS3yo+Jb6cBAp0FTKCPJ+iIyeMrGleEn2axjXRMBTUtz2IkxyT1E8BggNUQwHZ1iR8SrXk58hAp9DV4m0lTnqi9Pk8L10ILwlR/EHyf5pUZERCJrtpakHLR/Jz5t8sLgPDpXCg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717081817; c=relaxed/simple; bh=by3fDwUawOAZiFPX5EmBQ75F8qYb0KVYevegoexz4KA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=O1SPAzF+hZRtJ8XT9G+BB+D/LhPItNAtCV2AaGg1NrhZXeeFaz1MLXO2Ydd1PA/O+0huhsj4u06gKBCTem7mz/Q+m0chkyAiSLcu7kLqPN6bu/CfnuLoFyD+7CD5mdcJEqrmhnq/5/YpdnmAP1M6YYPoHOEybZSEctZCXKkoDcM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=13qxSm5g; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="13qxSm5g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B777C2BBFC; Thu, 30 May 2024 15:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1717081816; bh=by3fDwUawOAZiFPX5EmBQ75F8qYb0KVYevegoexz4KA=; h=From:To:Cc:Subject:Date:Reply-to:From; b=13qxSm5gUsc++5zE33gJAR1eOwooZ5T3ODmwRnnsE5jP97kC+klrLKRvp1gUs18qr mTuKZWUd+ENKENj+acjSmtGD4RbzqPTsEG42ix/XKLKFkpBlpV07uGj6NaH7mTPLRN J22RY6B/s32RK+C3K6eHMvDfAKIsSl6Fox7VhAQo= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-36027: btrfs: zoned: do not flag ZEROOUT on non-dirty extent buffer Date: Thu, 30 May 2024 17:10:22 +0200 Message-ID: <2024053021-CVE-2024-36027-2bf9@gregkh> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3062; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=by3fDwUawOAZiFPX5EmBQ75F8qYb0KVYevegoexz4KA=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkR0+4u2fGJiak7c7+5dbcA2+NpgSci+LZbLhTwb0l6K vNpYsWZjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjIl0kMc3i6T9WduhiR3G2s v+xj4+PK6ANt5xnm2azbHGi4f7PRb4lwB1PBnLe56s2+AA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: btrfs: zoned: do not flag ZEROOUT on non-dirty extent buffer Btrfs clears the content of an extent buffer marked as EXTENT_BUFFER_ZONED_ZEROOUT before the bio submission. This mechanism is introduced to prevent a write hole of an extent buffer, which is once allocated, marked dirty, but turns out unnecessary and cleaned up within one transaction operation. Currently, btrfs_clear_buffer_dirty() marks the extent buffer as EXTENT_BUFFER_ZONED_ZEROOUT, and skips the entry function. If this call happens while the buffer is under IO (with the WRITEBACK flag set, without the DIRTY flag), we can add the ZEROOUT flag and clear the buffer's content just before a bio submission. As a result: 1) it can lead to adding faulty delayed reference item which leads to a FS corrupted (EUCLEAN) error, and 2) it writes out cleared tree node on disk The former issue is previously discussed in [1]. The corruption happens when it runs a delayed reference update. So, on-disk data is safe. [1] https://lore.kernel.org/linux-btrfs/3f4f2a0ff1a6c818050434288925bdcf3cd719e5.1709124777.git.naohiro.aota@wdc.com/ The latter one can reach on-disk data. But, as that node is already processed by btrfs_clear_buffer_dirty(), that will be invalidated in the next transaction commit anyway. So, the chance of hitting the corruption is relatively small. Anyway, we should skip flagging ZEROOUT on a non-DIRTY extent buffer, to keep the content under IO intact. The Linux kernel CVE team has assigned CVE-2024-36027 to this issue. Affected and fixed versions =========================== Issue introduced in 6.8 with commit aa6313e6ff2b and fixed in 6.8.8 with commit f4b994fccbb6 Issue introduced in 6.8 with commit aa6313e6ff2b and fixed in 6.9 with commit 68879386180c Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2024-36027 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: fs/btrfs/extent_io.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/f4b994fccbb6f294c4b31a6ca0114b09f7245043 https://git.kernel.org/stable/c/68879386180c0efd5a11e800b0525a01068c9457