Files
linux/kernel
Masami Hiramatsu (Google) c8c1e40968 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: 06e0d3b89d ("kprobes: Make optprobe optimizer multi-generational and asynchronous")
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
2026-11-13 17:32:47 +09:00
..
…
…
2026-09-28 08:44:41 +02:00
…
…
…
…
…
2026-11-11 12:32:07 +01:00
2026-10-12 11:13:01 +02:00
…
…
…
…
2026-10-24 00:46:49 -07:00
2026-01-26 19:07:13 -08:00
…
…
2026-09-04 12:46:45 +02:00