diff options
| author | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-11-11 23:13:40 +0900 |
|---|---|---|
| committer | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-11-13 17:32:47 +0900 |
| commit | c8c1e4096830e3f2deda00661bdecfe06d113460 (patch) | |
| tree | 7e86ef00c919d5e26f01fa8c0dc04b6510fa719b /rust/kernel/alloc/kvec/errors.rs | |
| parent | f60f98881b54b0cf36b61f41c91fbd93b76a2d9c (diff) | |
kprobes: Fix UAF and queue cooling probes on forced unoptimization
When unoptimize_kprobe() is called with force = true on an actively
optimized probe (whose op->list is empty), force_unoptimize_kprobe()
replaces the relative jump with a breakpoint, but leaves op->list empty
without queueing op to cur->cooling_list.
Because op->list remains empty, kprobe_disarmed() returns true
prematurely as soon as the probe is disabled. When unregister_kprobes()
runs, __unregister_kprobe_top() unhashes the probe immediately, and
unregister_kprobes() frees op and the optinsn slot after synchronize_rcu()
without waiting for Tasks RCU. Any task preempted inside the optinsn slot
then encounters a use-after-free when resuming execution.
Queue forcibly unoptimized probes onto cur->cooling_list and include
gen->cooling_list in optprobe_has_queued_probes() so that the generation
is dispatched and flushed properly. In do_unoptimize_kprobes(), collect
newly unoptimized probes into a separate local list so that probes
already placed on freeing_list are not processed a second time.
Link: https://lore.kernel.org/all/179440642050.328088.13914468408589377897.stgit@devnote2/
Fixes: 06e0d3b89da1 ("kprobes: Make optprobe optimizer multi-generational and asynchronous")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Diffstat (limited to 'rust/kernel/alloc/kvec/errors.rs')
0 files changed, 0 insertions, 0 deletions
