CVE-2024-26727
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
03/04/2024
Last modified:
17/03/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
btrfs: do not ASSERT() if the newly created subvolume already got read<br />
<br />
[BUG]<br />
There is a syzbot crash, triggered by the ASSERT() during subvolume<br />
creation:<br />
<br />
assertion failed: !anon_dev, in fs/btrfs/disk-io.c:1319<br />
------------[ cut here ]------------<br />
kernel BUG at fs/btrfs/disk-io.c:1319!<br />
invalid opcode: 0000 [#1] PREEMPT SMP KASAN<br />
RIP: 0010:btrfs_get_root_ref.part.0+0x9aa/0xa60<br />
<br />
btrfs_get_new_fs_root+0xd3/0xf0<br />
create_subvol+0xd02/0x1650<br />
btrfs_mksubvol+0xe95/0x12b0<br />
__btrfs_ioctl_snap_create+0x2f9/0x4f0<br />
btrfs_ioctl_snap_create+0x16b/0x200<br />
btrfs_ioctl+0x35f0/0x5cf0<br />
__x64_sys_ioctl+0x19d/0x210<br />
do_syscall_64+0x3f/0xe0<br />
entry_SYSCALL_64_after_hwframe+0x63/0x6b<br />
---[ end trace 0000000000000000 ]---<br />
<br />
[CAUSE]<br />
During create_subvol(), after inserting root item for the newly created<br />
subvolume, we would trigger btrfs_get_new_fs_root() to get the<br />
btrfs_root of that subvolume.<br />
<br />
The idea here is, we have preallocated an anonymous device number for<br />
the subvolume, thus we can assign it to the new subvolume.<br />
<br />
But there is really nothing preventing things like backref walk to read<br />
the new subvolume.<br />
If that happens before we call btrfs_get_new_fs_root(), the subvolume<br />
would be read out, with a new anonymous device number assigned already.<br />
<br />
In that case, we would trigger ASSERT(), as we really expect no one to<br />
read out that subvolume (which is not yet accessible from the fs).<br />
But things like backref walk is still possible to trigger the read on<br />
the subvolume.<br />
<br />
Thus our assumption on the ASSERT() is not correct in the first place.<br />
<br />
[FIX]<br />
Fix it by removing the ASSERT(), and just free the @anon_dev, reset it<br />
to 0, and continue.<br />
<br />
If the subvolume tree is read out by something else, it should have<br />
already get a new anon_dev assigned thus we only need to free the<br />
preallocated one.
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.9 (including) | 5.10.210 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.149 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.79 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.18 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.7.6 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.8:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.8:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.8:rc3:*:*:*:*:*:* | ||
| cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/3f5d47eb163bceb1b9e613c9003bae5fefc0046f
- https://git.kernel.org/stable/c/5a172344bfdabb46458e03708735d7b1a918c468
- https://git.kernel.org/stable/c/66b317a2fc45b2ef66527ee3f8fa08fb5beab88d
- https://git.kernel.org/stable/c/833775656d447c545133a744a0ed1e189ce61430
- https://git.kernel.org/stable/c/e03ee2fe873eb68c1f9ba5112fee70303ebf9dfb
- https://git.kernel.org/stable/c/e31546b0f34af21738c4ceac47d662c00ee6382f
- https://git.kernel.org/stable/c/3f5d47eb163bceb1b9e613c9003bae5fefc0046f
- https://git.kernel.org/stable/c/5a172344bfdabb46458e03708735d7b1a918c468
- https://git.kernel.org/stable/c/66b317a2fc45b2ef66527ee3f8fa08fb5beab88d
- https://git.kernel.org/stable/c/833775656d447c545133a744a0ed1e189ce61430
- https://git.kernel.org/stable/c/e03ee2fe873eb68c1f9ba5112fee70303ebf9dfb
- https://git.kernel.org/stable/c/e31546b0f34af21738c4ceac47d662c00ee6382f
- https://lists.debian.org/debian-lts-announce/2024/06/msg00017.html



