btrfs: do not strictly require dirty metadata threshold for metadata writepages
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 793955bca66c99defdffc857ae6eb7e8431d6bbe · < 4e159150a9a56d66d247f4b5510bed46fe58aa1c| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
btrfs: do not strictly require dirty metadata threshold for metadata writepages
[BUG] There is an internal report that over 1000 processes are waiting at the io_schedule_timeout() of balance_dirty_pages(), causing a system hang and trigger a kernel coredump.
The kernel is v6.4 kernel based, but the root problem still applies to any upstream kernel before v6.18.
[CAUSE] From Jan Kara for his wisdom on the dirty page balance behavior first.
This cgroup dirty limit was what was actually playing the role here because the cgroup had only a small amount of memory and so the dirty limit for it was something like 16MB.
Dirty throttling is responsible for enforcing that nobody can dirty (significantly) more dirty memory than there's dirty limit. Thus when a task is dirtying pages it periodically enters into balance_dirty_pages() and we let it sleep there to slow down the dirtying.
When the system is over dirty limit already (either globally or within a cgroup of the running task), we will not let the task exit from balance_dirty_pages() until the number of dirty pages drops below the limit.
From the CVE record · Linux
Btrfs metadata writeback can stall when its 32 MiB writeback threshold exceeds a cgroup’s dirty-page limit. Under those conditions, processes can remain blocked, causing a system hang. The input does not establish an attacker access requirement or user-interaction condition.
Engineers running Btrfs on upstream Linux kernels before v6.18 or affected LTS kernels should check their systems.