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 35BFC28C2AA for ; Thu, 10 Jul 2025 08:16: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=1752135413; cv=none; b=pYbGWxdeCap/xTez7L8HWMWVmgjcbTqKfdcP+kkK6zC/Lhe2KMdoI7DLbscZoBaj7/6pkj3YMCJzarZGXIdpdhGACKveH2tBL5VxY8o78Jy/daBZo5DLAGRCA9ywm6sJ0gkeZsnov4avtDBZ5a3oukkrKyyE5FFZBtDhJNn+uPs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752135413; c=relaxed/simple; bh=z76cP/tYyzu/JngqxhmJp8hB8RqetYt9DZ7hu67UJ6A=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=HgsXyQpEWeFEnXKmtL4vMj0lkIZhd+l1Ngfhrs0I3ZlNHIizGFRJ15cCQBJGkjkPCM6mkn+5FDrOX5WwWHg+FwwbgrjkGKMLnDjx8tKvcGhgH8wRXz/t/voRQ1M/o+RBcvXxqKDutRyIEtiUn6vz7oIeQh4Ft0plWvlPeddY8vo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=J4Iz2DU2; 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="J4Iz2DU2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B793DC4CEE3; Thu, 10 Jul 2025 08:16:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1752135413; bh=z76cP/tYyzu/JngqxhmJp8hB8RqetYt9DZ7hu67UJ6A=; h=From:To:Cc:Subject:Date:Reply-to:From; b=J4Iz2DU2DnmwTBxPuVggd26V7i1NXYwKMO9/lFetSysRW6k+7ypXEE9RHqbZfLPHR 6Hnv3KomDMpvqHdDLOOJ5+Dgq9sJBugrRaYDlvzqFLJSrBvVwYMUc/ZS+KvTaqjzjO oIaNRrg5/JiPen8BYVpRvR05YA61PRASC570vRW0= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38347: f2fs: fix to do sanity check on ino and xnid Date: Thu, 10 Jul 2025 10:15:55 +0200 Message-ID: <2025071036-CVE-2025-38347-0116@gregkh> X-Mailer: git-send-email 2.50.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=4670; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=NhDEUWDSsE2w2qV1UQUKgKaZf1eL8sCTlvfeBMNWadQ=; b=owGbwMvMwCRo6H6F97bub03G02pJDBn5ZStSExj/35zolmc86WHHKsfoQ2nV2pMcBK9Oj9wSW fOYw+VdRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEykoJBhwUExTi9eH47Yrbe0 BVQP7lr2euOWAIY5XKYl0vu6v0uGWa4q3eWio2S7csZ8AA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: f2fs: fix to do sanity check on ino and xnid syzbot reported a f2fs bug as below: INFO: task syz-executor140:5308 blocked for more than 143 seconds. Not tainted 6.14.0-rc7-syzkaller-00069-g81e4f8d68c66 #0 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:syz-executor140 state:D stack:24016 pid:5308 tgid:5308 ppid:5306 task_flags:0x400140 flags:0x00000006 Call Trace: context_switch kernel/sched/core.c:5378 [inline] __schedule+0x190e/0x4c90 kernel/sched/core.c:6765 __schedule_loop kernel/sched/core.c:6842 [inline] schedule+0x14b/0x320 kernel/sched/core.c:6857 io_schedule+0x8d/0x110 kernel/sched/core.c:7690 folio_wait_bit_common+0x839/0xee0 mm/filemap.c:1317 __folio_lock mm/filemap.c:1664 [inline] folio_lock include/linux/pagemap.h:1163 [inline] __filemap_get_folio+0x147/0xb40 mm/filemap.c:1917 pagecache_get_page+0x2c/0x130 mm/folio-compat.c:87 find_get_page_flags include/linux/pagemap.h:842 [inline] f2fs_grab_cache_page+0x2b/0x320 fs/f2fs/f2fs.h:2776 __get_node_page+0x131/0x11b0 fs/f2fs/node.c:1463 read_xattr_block+0xfb/0x190 fs/f2fs/xattr.c:306 lookup_all_xattrs fs/f2fs/xattr.c:355 [inline] f2fs_getxattr+0x676/0xf70 fs/f2fs/xattr.c:533 __f2fs_get_acl+0x52/0x870 fs/f2fs/acl.c:179 f2fs_acl_create fs/f2fs/acl.c:375 [inline] f2fs_init_acl+0xd7/0x9b0 fs/f2fs/acl.c:418 f2fs_init_inode_metadata+0xa0f/0x1050 fs/f2fs/dir.c:539 f2fs_add_inline_entry+0x448/0x860 fs/f2fs/inline.c:666 f2fs_add_dentry+0xba/0x1e0 fs/f2fs/dir.c:765 f2fs_do_add_link+0x28c/0x3a0 fs/f2fs/dir.c:808 f2fs_add_link fs/f2fs/f2fs.h:3616 [inline] f2fs_mknod+0x2e8/0x5b0 fs/f2fs/namei.c:766 vfs_mknod+0x36d/0x3b0 fs/namei.c:4191 unix_bind_bsd net/unix/af_unix.c:1286 [inline] unix_bind+0x563/0xe30 net/unix/af_unix.c:1379 __sys_bind_socket net/socket.c:1817 [inline] __sys_bind+0x1e4/0x290 net/socket.c:1848 __do_sys_bind net/socket.c:1853 [inline] __se_sys_bind net/socket.c:1851 [inline] __x64_sys_bind+0x7a/0x90 net/socket.c:1851 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Let's dump and check metadata of corrupted inode, it shows its xattr_nid is the same to its i_ino. dump.f2fs -i 3 chaseyu.img.raw i_xattr_nid [0x 3 : 3] So that, during mknod in the corrupted directory, it tries to get and lock inode page twice, result in deadlock. - f2fs_mknod - f2fs_add_inline_entry - f2fs_get_inode_page --- lock dir's inode page - f2fs_init_acl - f2fs_acl_create(dir,..) - __f2fs_get_acl - f2fs_getxattr - lookup_all_xattrs - __get_node_page --- try to lock dir's inode page In order to fix this, let's add sanity check on ino and xnid. The Linux kernel CVE team has assigned CVE-2025-38347 to this issue. Affected and fixed versions =========================== Fixed in 6.6.95 with commit aaddc6c696bd1bff20eaacfa88579d6eae64d541 Fixed in 6.12.35 with commit fed611bd8c7b76b070aa407d0c7558e20d9e1f68 Fixed in 6.15.4 with commit 5a06d97d5340c00510f24e80e8de821bd3bd9285 Fixed in 6.16-rc1 with commit 061cf3a84bde038708eb0f1d065b31b7c2456533 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-38347 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/inode.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/aaddc6c696bd1bff20eaacfa88579d6eae64d541 https://git.kernel.org/stable/c/fed611bd8c7b76b070aa407d0c7558e20d9e1f68 https://git.kernel.org/stable/c/5a06d97d5340c00510f24e80e8de821bd3bd9285 https://git.kernel.org/stable/c/061cf3a84bde038708eb0f1d065b31b7c2456533