CVE-2025-37931
btrfs: adjust subpage bit start based on sectorsize
Check your servers for CVE-2025-37931
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2025-37931 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
In the Linux kernel, the following vulnerability has been resolved:
btrfs: adjust subpage bit start based on sectorsize
When running machines with 64k page size and a 16k nodesize we started seeing tree log corruption in production. This turned out to be because we were not writing out dirty blocks sometimes, so this in fact affects all metadata writes.
When writing out a subpage EB we scan the subpage bitmap for a dirty range. If the range isn't dirty we do
bit_start++;
to move onto the next bit. The problem is the bitmap is based on the number of sectors that an EB has. So in this case, we have a 64k pagesize, 16k nodesize, but a 4k sectorsize. This means our bitmap is 4 bits for every node. With a 64k page size we end up with 4 nodes per page.
To make this easier this is how everything looks
[0 16k 32k 48k ] logical address [0 4 8 12 ] radix tree offset [ 64k page ] folio [ 16k eb ][ 16k eb ][ 16k eb ][ 16k eb ] extent buffers [ | | | | | | | | | | | | | | | | ] bitmap
Now we use all of our addressing based on fs_info->sectorsize_bits, so as you can see the above our 16k eb->start turns into radix entry 4.
When we find a dirty range for our eb, we correctly do bit_start += sectors_per_node, because if we start at bit 0, the next bit for the next eb is 4, to correspond to eb->start 16k.
However if our range is clean, we will do bit_start++, which will now put us offset from our radix tree entries.
In our case, assume that the first time we check the bitmap the block is not dirty, we increment bit_start so now it == 1, and then we loop around and check again. This time it is dirty, and we go to find that start using the following equation
start = folio_start + bit_start * fs_info->sectorsize;
so in the case above, eb->start 0 is now dirty, and we calculate start as
0 + 1 * fs_info->sectorsize = 4096 4096 >> 12 = 1
Now we're looking up the radix tree for 1, and we won't find an eb. What's worse is now we're using bit_start == 1, so we do bit_start += sectors_per_node, which is now 5. If that eb is dirty we will run into the same thing, we will look at an offset that is not populated in the radix tree, and now we're skipping the writeout of dirty extent buffers.
The best fix for this is to not use sectorsize_bits to address nodes, but that's a larger change. Since this is a fs corruption problem fix it simply by always using sectors_per_node to increment the start bit.
Severity (CVSS)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:H
- Attack vector
- local: the attacker needs local access, or a user has to open a prepared file
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality low, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.22%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 13.0% of all scored CVEs. Scores of 1 Dec 2026.
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from c4aec299fa8f73f0fd10bc556f936f0da50e3e83, before 5111b148360f50cac9abbae8fca44cc0ac4bf9bf affected from c4aec299fa8f73f0fd10bc556f936f0da50e3e83, before 977849e8acd2466ac3cb49e04a3ecc73837f6b90 affected from c4aec299fa8f73f0fd10bc556f936f0da50e3e83, before b80db09b614cb7edec5bada1bc7c7b0eb3b453ea affected from c4aec299fa8f73f0fd10bc556f936f0da50e3e83, before 396f4002710030ea1cfd4c789ebaf0a6969ab34f affected from c4aec299fa8f73f0fd10bc556f936f0da50e3e83, before e08e49d986f82c30f42ad0ed43ebbede1e1e3739
Other versions: unaffected
|
| Linux |
affected 5.13 unaffected before 5.13 unaffected from 6.1.151 up to and including 6.1.* unaffected from 6.6.105 up to and including 6.6.* unaffected from 6.12.28 up to and including 6.12.* unaffected from 6.14.6 up to and including 6.14.* unaffected 6.15 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2025-37931 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2025-37931
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2025-37931
trivy image --scanners vuln IMAGE | grep CVE-2025-37931
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/5111b148360f50cac9abbae8fca44cc0ac4bf9bf git.kernel.org
- https://git.kernel.org/stable/c/977849e8acd2466ac3cb49e04a3ecc73837f6b90 git.kernel.org
- https://git.kernel.org/stable/c/b80db09b614cb7edec5bada1bc7c7b0eb3b453ea git.kernel.org
- https://git.kernel.org/stable/c/396f4002710030ea1cfd4c789ebaf0a6969ab34f git.kernel.org
- https://git.kernel.org/stable/c/e08e49d986f82c30f42ad0ed43ebbede1e1e3739 git.kernel.org
- https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html lists.debian.org
- https://cert-portal.siemens.com/productcert/html/ssa-032379.html cert-portal.siemens.com
Source: the record CVE-2025-37931 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse