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 15F05156230 for ; Wed, 16 Apr 2025 14:18:53 +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=1744813133; cv=none; b=PvKhlSDRMz1sbsfO0+iQHo8QfSXCIdfShqBgCxISg4mCz9www7MSORABh6Php218MEtycYfFc00nYroIdgA2iqp1Ye1i2Z79mBsd+JgRmN4d7P59h4FRzQLqu0Uld72c/F4ZZ6SXylrFEpHLCEClQa9c+1vRTzzVNzIdRYuXdbs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744813133; c=relaxed/simple; bh=Rm0eYbrFoZ9CZXwYrfMjX59uiTtyO/oRl3hSDNBqrpY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=toDJVQeK6xfZMYFYoieEgSKKbF/QP+hj+HljMg0QCMhgHg+m7UEchk617Cv4Sw1ESNSQ4nxhE+luSTzHD8hgEuQ5WFjaNnETiC4d7KhlfDNpM2mekes8HiU78SQjwLuwpDde7j4hufrD6CHKtCBr0deUKydccXbH6peZhbNZd48= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uIZRYKgu; 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="uIZRYKgu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B14DC4CEE2; Wed, 16 Apr 2025 14:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744813133; bh=Rm0eYbrFoZ9CZXwYrfMjX59uiTtyO/oRl3hSDNBqrpY=; h=From:To:Cc:Subject:Date:Reply-to:From; b=uIZRYKguKnC6k0uYNAc5ihx9ivUVg5UTibWo50w/N4IyYcHNwSERbIL4jKRhYfA6b RYIDKI281vGuuZ04AU6cB0DsM3SWlQfyi/DfSb/p4U6loJ0kc8tlgC50qj0VXVo3Ru OLgoxy59U1j1HCpZ12RiF4y+DeAXZ/ywtg0TreYU= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-22127: f2fs: fix potential deadloop in prepare_compress_overwrite() Date: Wed, 16 Apr 2025 16:13:38 +0200 Message-ID: <2025041630-CVE-2025-22127-81a6@gregkh> X-Mailer: git-send-email 2.49.0 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=3501; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Rm0eYbrFoZ9CZXwYrfMjX59uiTtyO/oRl3hSDNBqrpY=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn/d51zUF3PJx+bEWQeYx6yZVeU6YGUvwe2nQw1CIjg/ JvgMv9JRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAExkIRPDXOlQX5OEC57Rd2Q4 Oup/72TbIDazimGeTshF1eCdc6OOzXi3pHPZK0aOzuSdAA== 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 potential deadloop in prepare_compress_overwrite() Jan Prusakowski reported a kernel hang issue as below: When running xfstests on linux-next kernel (6.14.0-rc3, 6.12) I encountered a problem in generic/475 test where fsstress process gets blocked in __f2fs_write_data_pages() and the test hangs. The options I used are: MKFS_OPTIONS -- -O compression -O extra_attr -O project_quota -O quota /dev/vdc MOUNT_OPTIONS -- -o acl,user_xattr -o discard,compress_extension=* /dev/vdc /vdc INFO: task kworker/u8:0:11 blocked for more than 122 seconds. Not tainted 6.14.0-rc3-xfstests-lockdep #1 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:kworker/u8:0 state:D stack:0 pid:11 tgid:11 ppid:2 task_flags:0x4208160 flags:0x00004000 Workqueue: writeback wb_workfn (flush-253:0) Call Trace: __schedule+0x309/0x8e0 schedule+0x3a/0x100 schedule_preempt_disabled+0x15/0x30 __mutex_lock+0x59a/0xdb0 __f2fs_write_data_pages+0x3ac/0x400 do_writepages+0xe8/0x290 __writeback_single_inode+0x5c/0x360 writeback_sb_inodes+0x22f/0x570 wb_writeback+0xb0/0x410 wb_do_writeback+0x47/0x2f0 wb_workfn+0x5a/0x1c0 process_one_work+0x223/0x5b0 worker_thread+0x1d5/0x3c0 kthread+0xfd/0x230 ret_from_fork+0x31/0x50 ret_from_fork_asm+0x1a/0x30 The root cause is: once generic/475 starts toload error table to dm device, f2fs_prepare_compress_overwrite() will loop reading compressed cluster pages due to IO error, meanwhile it has held .writepages lock, it can block all other writeback tasks. Let's fix this issue w/ below changes: - add f2fs_handle_page_eio() in prepare_compress_overwrite() to detect IO error. - detect cp_error earler in f2fs_read_multi_pages(). The Linux kernel CVE team has assigned CVE-2025-22127 to this issue. Affected and fixed versions =========================== Issue introduced in 5.6 with commit 4c8ff7095bef64fc47e996a938f7d57f9e077da3 and fixed in 6.14.2 with commit 7215cf8ef54bdc9082dffac4662416d54961e258 Issue introduced in 5.6 with commit 4c8ff7095bef64fc47e996a938f7d57f9e077da3 and fixed in 6.15-rc1 with commit 3147ee567dd9004a49826ddeaf0a4b12865d4409 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-2025-22127 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/compress.c fs/f2fs/data.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/7215cf8ef54bdc9082dffac4662416d54961e258 https://git.kernel.org/stable/c/3147ee567dd9004a49826ddeaf0a4b12865d4409