blk-iolatency: Fix inflight count imbalances and IO hangs on offline
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 8c772a9bfc7c07c76f4a58b58910452fbb20843b · < 5b0ff3ebbef791341695b718f8d2870869cf1d01| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
blk-iolatency: Fix inflight count imbalances and IO hangs on offline
iolatency needs to track the number of inflight IOs per cgroup. As this tracking can be expensive, it is disabled when no cgroup has iolatency configured for the device. To ensure that the inflight counters stay balanced, iolatency_set_limit() freezes the request_queue while manipulating the enabled counter, which ensures that no IO is in flight and thus all counters are zero.
Unfortunately, iolatency_set_limit() isn't the only place where the enabled counter is manipulated. iolatency_pd_offline() can also dec the counter and trigger disabling. As this disabling happens without freezing the q, this can easily happen while some IOs are in flight and thus leak the counts.
This can be easily demonstrated by turning on iolatency on an one empty cgroup while IOs are in flight in other cgroups and then removing the cgroup. Note that iolatency shouldn't have been enabled elsewhere in the system to ensure that removing the cgroup disables iolatency for the whole device.
The following keeps flipping on and off iolatency on sda:
echo +io > /sys/fs/cgroup/cgroup.subtree_control while true; do mkdir -p /sys/fs/cgroup/test echo '8:0 target=100000' > /sys/fs/cgroup/test/io.latency sleep 1 rmdir /sys/fs/cgroup/test sleep 1 done
and there's concurrent fio generating direct rand reads:
From the CVE record · Linux
The Linux kernel's blk-iolatency can leave inflight IO counts unbalanced when a cgroup is removed while IO is in flight. If a cgroup with a stuck count is later throttled, its IO can hang indefinitely. This requires local cgroup configuration and concurrent IO; the input does not specify authentication requirements or user interaction.
Operators running Linux kernels that use blk-iolatency should check their kernel against the vendor advisory; affected versions were not provided.