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 E70DD304BD5 for ; Wed, 12 Nov 2025 10:24:15 +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=1762943056; cv=none; b=jizDVIIUvbDQIL5JdzKt7xQML0B26nzH+JK9mcozea/pImj/its8t20fDOzzk3itUhQNWZPRl37jyA0+KmX5o2zvwAAK1Vm07+pZRkxyo+rEiHTdjpB0PDZRlDu55c/qQzkKnVHQUvUqnbbXVRxmKhAsj3CmbYim1tfAj+CORwc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762943056; c=relaxed/simple; bh=z30DmoMAbn/WWYnJWAl9JKTmkWsORH1Ng581PFNApAg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=N6AdvIWEM2HRFhKggOGY/bgnq83EixEw5gnFy00IPrOlqgF1/mG0Im1HR8SLGe62zJQEVLPk4JQfkYg0CQZlWYsXURrazvr5DlAYpDf8XECUdMCG0JOaC3F9DTsnkTGchUDz5Gs7vq36QYXBtbMpQnbq0q0ut4YxGqX1KNs6gt8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0fgqvxdw; 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="0fgqvxdw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C081C116B1; Wed, 12 Nov 2025 10:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1762943055; bh=z30DmoMAbn/WWYnJWAl9JKTmkWsORH1Ng581PFNApAg=; h=From:To:Cc:Subject:Date:Reply-to:From; b=0fgqvxdwNODZnfYfpLp9b5L3PcKKHE0WtfkfT5tCC7HgbyUsfiHORVMxhLkcy1VYT O8RiZRKKvKc/YqoBcPrB4wnbDpLDDlu80bzCReZ7gSgBoWdJf+OKLU15T1jsBOcJpO 6BSzGAiDJXPoFaYbGYT1TuVX97epcXqOa7IrO7Qc= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-40128: btrfs: fix symbolic link reading when bs > ps Date: Wed, 12 Nov 2025 19:24:04 +0900 Message-ID: <2025111253-CVE-2025-40128-2dd9@gregkh> X-Mailer: git-send-email 2.51.2 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=4357; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=+C/XuBS/Pi9p7+YPex3T2+pubcQUWvWPyh1bTj6c2w0=; b=owGbwMvMwCRo6H6F97bub03G02pJDJkiCZb2WXuCdk7r87gd/0TH4jJ7imHHpLPmS8ImZ/gpM ekfKp7bEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABOpVWCYw6F8SXfRdsdNUzZy vzr6YcmudV+D+RgWnG99dvjJqX4z+QW60b9/PDPesVDqHQA= 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: btrfs: fix symbolic link reading when bs > ps [BUG DURING BS > PS TEST] When running the following script on a btrfs whose block size is larger than page size, e.g. 8K block size and 4K page size, it will trigger a kernel BUG: # mkfs.btrfs -s 8k $dev # mount $dev $mnt # mkdir $mnt/dir # ln -s dir $mnt/link # ls $mnt/link The call trace looks like this: BTRFS warning (device dm-2): support for block size 8192 with page size 4096 is experimental, some features may be missing BTRFS info (device dm-2): checking UUID tree BTRFS info (device dm-2): enabling ssd optimizations BTRFS info (device dm-2): enabling free space tree ------------[ cut here ]------------ kernel BUG at /home/adam/linux/include/linux/highmem.h:275! Oops: invalid opcode: 0000 [#1] SMP CPU: 8 UID: 0 PID: 667 Comm: ls Tainted: G OE 6.17.0-rc4-custom+ #283 PREEMPT(full) Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS unknown 02/02/2022 RIP: 0010:zero_user_segments.constprop.0+0xdc/0xe0 [btrfs] Call Trace: btrfs_get_extent.cold+0x85/0x101 [btrfs 7453c70c03e631c8d8bfdd4264fa62d3e238da6f] btrfs_do_readpage+0x244/0x750 [btrfs 7453c70c03e631c8d8bfdd4264fa62d3e238da6f] btrfs_read_folio+0x9c/0x100 [btrfs 7453c70c03e631c8d8bfdd4264fa62d3e238da6f] filemap_read_folio+0x37/0xe0 do_read_cache_folio+0x94/0x3e0 __page_get_link.isra.0+0x20/0x90 page_get_link+0x16/0x40 step_into+0x69b/0x830 path_lookupat+0xa7/0x170 filename_lookup+0xf7/0x200 ? set_ptes.isra.0+0x36/0x70 vfs_statx+0x7a/0x160 do_statx+0x63/0xa0 __x64_sys_statx+0x90/0xe0 do_syscall_64+0x82/0xae0 entry_SYSCALL_64_after_hwframe+0x4b/0x53 Please note bs > ps support is still under development and the enablement patch is not even in btrfs development branch. [CAUSE] Btrfs reuses its data folio read path to handle symbolic links, as the symbolic link target is stored as an inline data extent. But for newly created inodes, btrfs only set the minimal order if the target inode is a regular file. Thus for above newly created symbolic link, it doesn't properly respect the minimal folio order, and triggered the above crash. [FIX] Call btrfs_set_inode_mapping_order() unconditionally inside btrfs_create_new_inode(). For symbolic links this will fix the crash as now the folio will meet the minimal order. For regular files this brings no change. For directory/bdev/char and all the other types of inodes, they won't go through the data read path, thus no effect either. The Linux kernel CVE team has assigned CVE-2025-40128 to this issue. Affected and fixed versions =========================== Issue introduced in 6.17 with commit cc38d178ff33543cdb0bd58cfbb9a7c41372ff75 and fixed in 6.17.3 with commit 3ea252a5c48dd3a4e1f7d0c53d3b0f7b648becc9 Issue introduced in 6.17 with commit cc38d178ff33543cdb0bd58cfbb9a7c41372ff75 and fixed in 6.18-rc1 with commit 67378b754608a3524d125bfa5744508a49fe48be 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-40128 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/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/3ea252a5c48dd3a4e1f7d0c53d3b0f7b648becc9 https://git.kernel.org/stable/c/67378b754608a3524d125bfa5744508a49fe48be