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 570801F4711 for ; Fri, 27 Dec 2024 13:56:58 +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=1735307818; cv=none; b=efUxv+UvVu5tC2akvedN3DeSbJmKL4XcOrs6+QwH67GuBRtkvwrbaOEhmN8Oe8BxU1DDA+eP6VH/AJj/6Qv66s5KV7apg9x8Si3nYja2R6RPjzy+O61sfcKTT3DQKexFwDJdur/TcZOfk2tvSwGDp4ZT/8MmQrxwjch+WhRoqOA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735307818; c=relaxed/simple; bh=jm+/UkeQlNEeWGH3FUcCZONm5drrROG+/1NDO5wsd34=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=pGCRHH7QEn1DW9O6mkrMYZ7yw7nAQxkG0YRbOj6ZG0w02B/eTlizNlrXDGysr0qgViOhXiOx7w6roSLQNbo8PxsOAqt5UIlAyqCe+/15Wr8+SUcdh/vmv+C8NRyFTOUGluAEl77RLjha3zMgb/TF4+4cnZizRLqpTDBs4y0e6Mc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fWpJ/e7g; 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="fWpJ/e7g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9BCEC4CED0; Fri, 27 Dec 2024 13:56:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1735307818; bh=jm+/UkeQlNEeWGH3FUcCZONm5drrROG+/1NDO5wsd34=; h=From:To:Cc:Subject:Date:Reply-to:From; b=fWpJ/e7ggE9g7XF9Xn04aHnNvWQ7ftSls5CFAXlsaXEee5gQqd0MFLiDC2z5k/yjI DQjvGtF6DzQTvh7K07Sd073UHfAGPFVahWkIIS5CmuN1LjVGjc7zI8eGcggUUFHXk7 Vj+/o9hXlzmeyemNc/w3ZaEKpF9+BfZ+/Esx360g= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-53220: f2fs: fix to account dirty data in __get_secs_required() Date: Fri, 27 Dec 2024 14:53:06 +0100 Message-ID: <2024122733-CVE-2024-53220-3664@gregkh> X-Mailer: git-send-email 2.47.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=3684; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=jm+/UkeQlNEeWGH3FUcCZONm5drrROG+/1NDO5wsd34=; b=owGbwMvMwCRo6H6F97bub03G02pJDOl5GxU7VOYePq90IVPx9+SqPysk91kKT3h28pf3WrZtP +Wb4r2+dMSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEamUZFhx5uOBffJyqV/E3 Obljfd8DnNdc2cow3yFndnv+O7Mz9/+oqOvefB9QLGAtDgA= 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: f2fs: fix to account dirty data in __get_secs_required() It will trigger system panic w/ testcase in [1]: ------------[ cut here ]------------ kernel BUG at fs/f2fs/segment.c:2752! RIP: 0010:new_curseg+0xc81/0x2110 Call Trace: f2fs_allocate_data_block+0x1c91/0x4540 do_write_page+0x163/0xdf0 f2fs_outplace_write_data+0x1aa/0x340 f2fs_do_write_data_page+0x797/0x2280 f2fs_write_single_data_page+0x16cd/0x2190 f2fs_write_cache_pages+0x994/0x1c80 f2fs_write_data_pages+0x9cc/0xea0 do_writepages+0x194/0x7a0 filemap_fdatawrite_wbc+0x12b/0x1a0 __filemap_fdatawrite_range+0xbb/0xf0 file_write_and_wait_range+0xa1/0x110 f2fs_do_sync_file+0x26f/0x1c50 f2fs_sync_file+0x12b/0x1d0 vfs_fsync_range+0xfa/0x230 do_fsync+0x3d/0x80 __x64_sys_fsync+0x37/0x50 x64_sys_call+0x1e88/0x20d0 do_syscall_64+0x4b/0x110 entry_SYSCALL_64_after_hwframe+0x76/0x7e The root cause is if checkpoint_disabling and lfs_mode are both on, it will trigger OPU for all overwritten data, it may cost more free segment than expected, so f2fs must account those data correctly to calculate cosumed free segments later, and return ENOSPC earlier to avoid run out of free segment during block allocation. [1] https://lore.kernel.org/fstests/20241015025106.3203676-1-chao@kernel.org/ The Linux kernel CVE team has assigned CVE-2024-53220 to this issue. Affected and fixed versions =========================== Issue introduced in 4.20 with commit 4354994f097d068a894aa1a0860da54571df3582 and fixed in 6.1.120 with commit 6e58b2987960efcd917bc42da781cee256213618 Issue introduced in 4.20 with commit 4354994f097d068a894aa1a0860da54571df3582 and fixed in 6.6.64 with commit f1b8bfe8d2f2fdf905d37c174d5bc1cd2b6910c5 Issue introduced in 4.20 with commit 4354994f097d068a894aa1a0860da54571df3582 and fixed in 6.11.11 with commit 9313b85ddc120e2d2f0efaf86d0204d4c98d60b1 Issue introduced in 4.20 with commit 4354994f097d068a894aa1a0860da54571df3582 and fixed in 6.12.2 with commit e812871c068cc0f91ff9f5cee87d00df1c44aae4 Issue introduced in 4.20 with commit 4354994f097d068a894aa1a0860da54571df3582 and fixed in 6.13-rc1 with commit 1acd73edbbfef2c3c5b43cba4006a7797eca7050 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-53220 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/f2fs/segment.h 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/6e58b2987960efcd917bc42da781cee256213618 https://git.kernel.org/stable/c/f1b8bfe8d2f2fdf905d37c174d5bc1cd2b6910c5 https://git.kernel.org/stable/c/9313b85ddc120e2d2f0efaf86d0204d4c98d60b1 https://git.kernel.org/stable/c/e812871c068cc0f91ff9f5cee87d00df1c44aae4 https://git.kernel.org/stable/c/1acd73edbbfef2c3c5b43cba4006a7797eca7050