Look up another CVE · open CVE-2025-37856 in the interactive tracker
CVE-2025-37856
btrfs: harden block_group::bg_list against list_del() races
Published 2025-05-09 (17 months ago) by the Linux kernel CNA. Subsystem fs/btrfs. Debian urgency: not yet assigned.
What to do, per Debian release
Debian's own status for CVE-2025-37856 in every release this site tracks, and what each one means in practice. Every status below is the one the Debian Security Team publishes for this CVE. source
| Release | Status | Version | What this means |
|---|---|---|---|
| Debian 12bookworm | vulnerable | 6.1.190-1 | No fix published anywhere yet, neither in Debian nor upstream for the series bookworm tracks. Watch the Debian tracker page for this CVE. Advisories for bookworm have historically landed a median of 23 days after publication. |
| Debian 13trixie | fixed | 6.12.25-1 | Update the kernel and reboot. Fixed in 6.12.25-1. A running kernel keeps the old code until the machine restarts. |
| Debian 14forky | fixed | 6.12.25-1 | Update the kernel and reboot. Fixed in 6.12.25-1. A running kernel keeps the old code until the machine restarts. |
| Debian unstablesid | fixed | 6.12.25-1 | Update the kernel and reboot. Fixed in 6.12.25-1. A running kernel keeps the old code until the machine restarts. |
The vulnerability
What the bug is
As far as I can tell, these calls of list_del_init() on bg_list cannot run concurrently with btrfs_mark_bg_unused() or btrfs_mark_bg_to_reclaim(), as they are in transaction error paths and situations where the block group is readonly. However, if there is any chance at all of racing with mark_bg_unused(), or a different future user of bg_list, better to be safe than sorry. Otherwise we risk the following interleaving (bg_list refcount in parens) T1 (some random op) T2 (btrfs_mark_bg_unused) !list_empty(&bg->bg_list); (1) list_del_init(&bg->bg_list); (1) list_move_tail (1) btrfs_put_block_group (0) btrfs_delete_unused_bgs bg = list_first_entry list_del_init(&bg->bg_list); btrfs_put_block_group(bg); (-1) Ultimately, this results in a broken ref count that hits zero one deref early and the real final deref underflows the refcount, resulting in a WARNING.
Where it lives
The fix touches these files. If the subsystem is one you do not use, the practical exposure is lower, though the package is still the vulnerable one.
fs/btrfs/extent-tree.c
fs/btrfs/transaction.c
- What this is
- BTRFS FILE SYSTEMMAINTAINERS section matched on fs/btrfs/ · linux-btrfs@vger.kernel.org · Maintained
- Kernel module
- btrfs
Check it on the machine
grep -w CONFIG_BTRFS_FS /boot/config-$(uname -r)Reads the booted kernel's own configuration, on the machine and nowhere else. =y is built in, =m is a module, and an is not set line means the code is not there.
lsmod | grep -w btrfsPrints a line if that module is loaded right now, and nothing if it is not. One that is not loaded can still be loaded later by anything that needs it.
Show whether Debian builds this, per release
Debian builds this as a loadable module. Every release below compiles it as a module on every flavour, so whether the code is in the running kernel depends on whether that module is loaded.
- bookworm, trixie, forky, sidm
- m
- a loadable module on every flavour - check lsmod, can be blacklisted
- Build switch
- CONFIG_BTRFS_FS
From the configuration Debian publishes for every kernel flavour it builds. It covers only the architectures Debian ships a linux-config package for, and nothing about a kernel you built yourself. Debian's own status above stays authoritative about the source package.MAINTAINERS kbuild Makefiles Debian linux-config packages
Signals
- Published
- 2025-05-09 (17 months ago)source
- CVSS
- 7.8 high
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:Hsource recompute it - Attack vector
- local (AV:L)source
- EPSS
- 0.28%, higher than 19.1% of all CVEssource
- CISA KEV
- not listedthe KEV catalogue
- Debian urgency
- not yet assignedsource
- Subsystem
- fs/btrfs
Upstream fixes
The versions the CNA records as introducing and fixing this, and the commit for each. source
| Introduced | Fixed in | Commit |
|---|---|---|
| 6.5 | 6.12.24 | bf089c4d1141 |
| 6.5 | 6.13.12 | 909e60fb469d |
| 6.5 | 6.14.3 | 185fd73e5ac0 |
| 6.5 | 6.15 | 7511e29cf135 |
| 5.15.128 | 0 | 0 |
| 6.1.47 | 0 | 0 |
| 6.4.12 | 0 | 0 |
Why the CNA scored it this way
Quoted from the kernel CNA's own scoring file, word for word. A highlighted metric carries the most severe value CVSS v3.1 defines for it, which is what pushes the score up. source
- AV:LAttack vector, local
- The vulnerable code is btrfs's core block-group allocator, reached through ordinary file creation/deletion, `sync()`/`fsync()`, and ENOSPC-driven transaction aborts on a locally mounted btrfs filesystem. There is no network protocol handler in the path.
- AC:LAttack complexity, low
- The attacker drives both sides of the race with a single unprivileged workload — emptying block groups feeds `btrfs_mark_bg_unused()` while `sync()` forces the `btrfs_finish_extent_commit()` traversal — and the create/delete/sync loop can be repeated indefinitely until the window is hit. The same bg_list refcount race was demonstrably reproduced in practice by its sibling CVE-2025-22115 and by fstests generic/297.
- PR:LPrivileges required, low
- Any unprivileged local user with write access to a btrfs mount (home directory, `/tmp`, or a container volume) can trigger the full sequence; no capability, no user namespace, and no CAP_SYS_ADMIN operation such as scrub or balance is required.
- UI:NUser interaction, none
- The attacker's own process performs every step, and the cleaner kthread consumes the freed object on its own timer. btrfs is the default root filesystem on Fedora and openSUSE, so no victim needs to mount anything.
- S:UScope, unchanged
- The refcount underflow, the freed object, and its consumer all live in the kernel's own security authority, with no crossing of a hypervisor, IOMMU, or sandbox boundary.
- C:HConfidentiality impact, high
- `btrfs_put_block_group()` `kfree()`s the block group into a general kmalloc cache while it is still linked on `fs_info->unused_bgs`, so an unprivileged heap spray can reclaim the slot and the cleaner kthread will read `space_info`, `start`, `length`, and `flags` back out of it, exposing kernel heap contents.
- I:HIntegrity impact, high
- `list_del_init()` on the freed node writes through attacker-reclaimed `prev`/`next` pointers, yielding a controlled kernel write primitive, and the downstream `btrfs_remove_chunk(trans, block_group->start)` operates on a garbage offset, destroying live on-disk btrfs metadata.
- A:HAvailability impact, high
- The refcount underflow raises `refcount_t: underflow; use-after-free`, an immediate panic under the widely deployed `panic_on_warn=1`, and the use-after-free crashes the cleaner kthread and can corrupt or wedge the filesystem outright.