CVE-2024-26727: btrfs: do not ASSERT() if the newly created subvolume already got read

Published Apr 3, 2024
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

btrfs: do not ASSERT() if the newly created subvolume already got read

[BUG] There is a syzbot crash, triggered by the ASSERT() during subvolume creation:

assertion failed: !anondev, in fs/btrfs/disk-io.c:1319 ------------[ cut here ]------------ kernel BUG at fs/btrfs/disk-io.c:1319! invalid opcode: 0000 [#1] PREEMPT SMP KASAN RIP: 0010:btrfsgetrootref.part.0+0x9aa/0xa60 <TASK> btrfsgetnewfsroot+0xd3/0xf0 createsubvol+0xd02/0x1650 btrfsmksubvol+0xe95/0x12b0 btrfsioctlsnapcreate+0x2f9/0x4f0 btrfsioctlsnapcreate+0x16b/0x200 btrfsioctl+0x35f0/0x5cf0 x64sysioctl+0x19d/0x210 dosyscall64+0x3f/0xe0 entrySYSCALL64afterhwframe+0x63/0x6b ---[ end trace 0000000000000000 ]---

[CAUSE] During createsubvol(), after inserting root item for the newly created subvolume, we would trigger btrfsgetnewfsroot() to get the btrfsroot of that subvolume.

The idea here is, we have preallocated an anonymous device number for the subvolume, thus we can assign it to the new subvolume.

But there is really nothing preventing things like backref walk to read the new subvolume. If that happens before we call btrfsgetnewfsroot(), the subvolume would be read out, with a new anonymous device number assigned already.

In that case, we would trigger ASSERT(), as we really expect no one to read out that subvolume (which is not yet accessible from the fs). But things like backref walk is still possible to trigger the read on the subvolume.

Thus our assumption on the ASSERT() is not correct in the first place.

[FIX] Fix it by removing the ASSERT(), and just free the @anondev, reset it to 0, and continue.

If the subvolume tree is read out by something else, it should have already get a new anondev assigned thus we only need to free the preallocated one.

Affected Software

10 affected components
Linux Kernel
Linux Linux kernel>=5.9<5.10.210
Linux Linux kernel>=5.11<5.15.149
Linux Linux kernel>=5.16<6.1.79
Linux Linux kernel>=6.2<6.6.18
Linux Linux kernel>=6.7<6.7.6
Linux Linux kernel=6.8-rc1
Linux Linux kernel=6.8-rc2
Linux Linux kernel=6.8-rc3
Debian Debian Linux=10.0

Event History

Apr 3, 2024
CVE Published
via MITRE·02:55 PM
Data Sourced
via MITRE·02:55 PM
Description
Data Sourced
via NVD·03:15 PM
Description

Frequently Asked Questions

1

What is the severity of CVE-2024-26727?

CVE-2024-26727 is categorized with a severity that potentially impacts the stability of the btrfs file system in the Linux kernel.

2

How do I fix CVE-2024-26727?

To mitigate CVE-2024-26727, you should update your Linux kernel to a version that includes the patch for this vulnerability.

3

What versions of the Linux kernel are affected by CVE-2024-26727?

CVE-2024-26727 affects specific versions of the Linux kernel ranging from 5.9 to 6.8-rc3.

4

What kind of issues does CVE-2024-26727 cause?

CVE-2024-26727 may cause crashes during the creation of btrfs subvolumes due to a failed assertion.

5

Is there a workaround for CVE-2024-26727 before applying a patch?

Currently, the best approach is to apply the available kernel updates as there are no known workarounds for CVE-2024-26727.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203