CVE-2024-35798: btrfs: fix race in read_extent_buffer_pages()

Published May 17, 2024
·
Updated

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

btrfs: fix race in readextentbufferpages()

There are reports from tree-checker that detects corrupted nodes, without any obvious pattern so possibly an overwrite in memory. After some debugging it turns out there's a race when reading an extent buffer the uptodate status can be missed.

To prevent concurrent reads for the same extent buffer, readextentbufferpages() performs these checks:

/ (1) / if (testbit(EXTENTBUFFERUPTODATE, &eb->bflags)) return 0;

/ (2) / if (testandsetbit(EXTENTBUFFERREADING, &eb->bflags)) goto done;

At this point, it seems safe to start the actual read operation. Once that completes, endbbiometaread() does

/ (3) / setextentbufferuptodate(eb);

/ (4) / clearbit(EXTENTBUFFERREADING, &eb->bflags);

Normally, this is enough to ensure only one read happens, and all other callers wait for it to finish before returning. Unfortunately, there is a racey interleaving:

Thread A | Thread B | Thread C ---------+----------+--------- (1) | | | (1) | (2) | | (3) | | (4) | | | (2) | | | (1)

When this happens, thread B kicks of an unnecessary read. Worse, thread C will see UPTODATE set and return immediately, while the read from thread B is still in progress. This race could result in tree-checker errors like this as the extent buffer is concurrently modified:

BTRFS critical (device dm-0): corrupted node, root=256 block=8550954455682405139 owner mismatch, have 11858205567642294356 expect [256, 18446744073709551360]

Fix it by testing UPTODATE again after setting the READING bit, and if it's been set, skip the unnecessary read.

[ minor update of changelog ]

Affected Software

5 affected componentsFixes available
debian/linux
5.10.223-15.10.234-16.1.129-16.1.135-16.12.25-16.12.27-1
Linux Linux kernel>=6.5<6.6.24
Linux Linux kernel>=6.7<6.7.12
Linux Linux kernel>=6.8<6.8.3
Linux Linux kernel=6.9-rc1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/linux to a version that resolves this vulnerability.

    Fixed in 5.10.223-1Fixed in 5.10.234-1Fixed in 6.1.129-1Fixed in 6.1.135-1Fixed in 6.12.25-1Fixed in 6.12.27-1

Event History

May 17, 2024
CVE Published
via MITRE·01:23 PM
Data Sourced
via MITRE·01:23 PM
DescriptionSeverity
Data Sourced
via NVD·02:15 PM
Description
Data Sourced
via NVD·02:15 PM
RemedySeverityWeaknessAffected Software
Jun 8, 2024
Data Sourced
via Launchpad·01:15 AM
Description
Dec 1, 2024
Data Sourced
via Ubuntu·05:30 AM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-35798?

The severity of CVE-2024-35798 is classified based on its potential impact on system integrity and security, particularly regarding memory overwrite issues.

2

How do I fix CVE-2024-35798?

To fix CVE-2024-35798, it is recommended to update to the patched versions of the Linux kernel: 5.10.223-1, 5.10.226-1, 6.1.119-1, 6.1.123-1, 6.12.11-1, or 6.12.12-1.

3

What software is affected by CVE-2024-35798?

CVE-2024-35798 affects specific versions of the Linux kernel, notably those on Debian systems.

4

What types of vulnerabilities does CVE-2024-35798 address?

CVE-2024-35798 addresses a race condition in the btrfs file system that may lead to memory corruption.

5

How can I verify if my system is vulnerable to CVE-2024-35798?

You can verify if your system is vulnerable to CVE-2024-35798 by checking the currently installed version of the Linux kernel against the affected versions.

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