Skip to main content

CVE-2024-41067: Vulnerability in Linux Linux

High
VulnerabilityCVE-2024-41067cvecve-2024-41067
Published: Mon Jul 29 2024 (07/29/2024, 14:57:28 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: btrfs: scrub: handle RST lookup error correctly [BUG] When running btrfs/060 with forced RST feature, it would crash the following ASSERT() inside scrub_read_endio(): ASSERT(sector_nr < stripe->nr_sectors); Before that, we would have tree dump from btrfs_get_raid_extent_offset(), as we failed to find the RST entry for the range. [CAUSE] Inside scrub_submit_extent_sector_read() every time we allocated a new bbio we immediately called btrfs_map_block() to make sure there was some RST range covering the scrub target. But if btrfs_map_block() fails, we immediately call endio for the bbio, while the bbio is newly allocated, it's completely empty. Then inside scrub_read_endio(), we go through the bvecs to find the sector number (as bi_sector is no longer reliable if the bio is submitted to lower layers). And since the bio is empty, such bvecs iteration would not find any sector matching the sector, and return sector_nr == stripe->nr_sectors, triggering the ASSERT(). [FIX] Instead of calling btrfs_map_block() after allocating a new bbio, call btrfs_map_block() first. Since our only objective of calling btrfs_map_block() is only to update stripe_len, there is really no need to do that after btrfs_alloc_bio(). This new timing would avoid the problem of handling empty bbio completely, and in fact fixes a possible race window for the old code, where if the submission thread is the only owner of the pending_io, the scrub would never finish (since we didn't decrease the pending_io counter). Although the root cause of RST lookup failure still needs to be addressed.

AI-Powered Analysis

AILast updated: 06/29/2025, 04:11:02 UTC

Technical Analysis

CVE-2024-41067 is a vulnerability identified in the Linux kernel's Btrfs filesystem scrub functionality. The issue arises specifically in the handling of the RAID Stripe Table (RST) lookup errors during the scrub operation, which is a process designed to verify and repair data integrity on Btrfs volumes. The vulnerability is triggered when the scrub process attempts to read a sector that is not properly mapped due to a failure in the btrfs_map_block() function call. In the flawed implementation, a bio buffer (bbio) is allocated before verifying the mapping, and if btrfs_map_block() fails, the bio is empty but still processed. This leads to an assertion failure (ASSERT(sector_nr < stripe->nr_sectors)) inside scrub_read_endio(), causing a kernel crash. The root cause is that the scrub code does not correctly handle the case where the RST lookup fails, resulting in an empty bio vector that triggers the assertion. The fix involves changing the order of operations to call btrfs_map_block() before allocating the bio, preventing the creation of empty bios and avoiding the race condition where the scrub process could hang indefinitely due to a pending_io counter not being decremented. Although this patch resolves the immediate crash and race condition, the underlying cause of the RST lookup failure remains unaddressed. This vulnerability affects Linux kernel versions identified by the given commit hashes and is relevant to systems using Btrfs with forced RST features enabled during scrub operations. No known exploits are reported in the wild as of the publication date.

Potential Impact

For European organizations, the impact of CVE-2024-41067 can be significant in environments relying on Btrfs filesystems, particularly those using the scrub feature with forced RST enabled. The vulnerability can cause kernel crashes leading to system instability or downtime, which affects availability. In critical infrastructure, data centers, or enterprise environments where Linux servers run Btrfs for storage, such crashes could disrupt services, cause data unavailability, and require system reboots or manual intervention. Although the vulnerability does not directly expose confidentiality or integrity risks, the denial-of-service potential through kernel panics can impact business continuity. Organizations with automated scrub processes for data integrity verification may experience unexpected failures, complicating maintenance and monitoring. Since no exploits are known in the wild, the immediate risk is moderate; however, the presence of a kernel panic vulnerability in a core filesystem component warrants prompt attention to avoid potential exploitation or accidental outages.

Mitigation Recommendations

European organizations should prioritize updating their Linux kernels to versions containing the fix for CVE-2024-41067 as soon as patches are available. Specifically, ensure that the kernel version includes the corrected scrub code that calls btrfs_map_block() prior to bio allocation. In the interim, organizations can mitigate risk by disabling forced RST features during scrub operations if feasible, or by limiting scrub operations to non-production windows to reduce the impact of potential crashes. Monitoring kernel logs for scrub-related assertion failures or crashes can help detect attempts to trigger this vulnerability. Additionally, organizations should review their Btrfs usage and consider alternative filesystems if forced RST features are critical and patches are delayed. Implementing robust backup and recovery procedures will mitigate data availability risks in case of system crashes. Finally, maintain close coordination with Linux distribution vendors for timely patch deployment and advisories.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-07-12T12:17:45.630Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9827c4522896dcbe17eb

Added to database: 5/21/2025, 9:08:55 AM

Last enriched: 6/29/2025, 4:11:02 AM

Last updated: 8/1/2025, 12:09:15 AM

Views: 11

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats