kprobes: Protect kprobe_blacklist with RCU
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 376e242429bf8539ef39a080ac113c8799840b13 · < 5da247e4d1e8661d4d6f997101d59967e8994e32| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
kprobes: Protect kprobe_blacklist with RCU
__within_kprobe_blacklist() traverses kprobe_blacklist without holding kprobe_mutex. When a module is unloaded, kprobe_remove_area_blacklist() removes blacklist entries and immediately frees them with kfree(). A concurrent call to within_kprobe_blacklist() can therefore dereference freed memory.
Furthermore, within_kprobe_blacklist() can be called in atomic or non-preemptible contexts where the sleeping kprobe_mutex cannot be taken.
Protect kprobe_blacklist with RCU. Use guard(rcu)() and list_for_each_entry_rcu() for traversal, list_add_tail_rcu() for insertions, list_del_rcu() for deletions, and kfree_rcu() to reclaim entries safely after a grace period.
From the CVE record · Linux
The Linux kernel's kprobes blacklist can be read while an entry is removed and freed during module unload, causing a use-after-free. This requires a concurrent module unload and blacklist check. The input does not establish an attacker path, authentication requirements, or user interaction.
Engineers running the Linux kernel should check their versions; affected versions are not specified in the input.