Linux Kernel Btrfs Deadlock Vulnerability During Concurrent Direct I/O Writes

Vulnerability

A deadlock vulnerability has been identified in the Linux kernel's Btrfs file system, specifically during concurrent direct I/O writes when free data space is low. The issue arises when multiple tasks attempt to write to the same file range without expanding the inode's size, leading to a deadlock situation. This vulnerability can be sporadically triggered by the test case generic/300 from fstests, resulting in tasks being blocked for an extended period.

Impact

Exploitation of this vulnerability leads to a deadlock involving four tasks: two tasks performing direct I/O writes, one asynchronous data reclaim task waiting to reserve data space, and a task responsible for completing ordered extents, causing a significant delay in file operations.

Reproduction

The vulnerability can be reproduced by creating a file with multiple extents and an i_size that does not accommodate the intended write range. Initiate a direct I/O write that overlaps with existing extents while another task attempts a similar write, creating a deadlock scenario. Monitor the system for signs of blocked tasks, indicating the deadlock has occurred.

Added: Jun 9, 2025, 7:46 PM
Updated: Jun 9, 2025, 7:46 PM

Vulnerability Rating

Custom Algorithm
spread
9.0
impact
2.5
exploitability
3.9
remediation
7.7
relevance
0.0
threat
4.8
urgency
2.9
incentive
1.7

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.