Re: [PATCH v2 0/3] kprobes: Fix optprobe state after forced unoptimization

From
Masami Hiramatsu (Google) <mhiramat@kernel.org>
Date
2026-11-08 23:37:07
Also in
lkml
Reply to
Mani Tofigh, 2026-11-05
On Thu, 05 Nov 2026 15:32:11 -0500, Mani Tofigh via B4 Relay [off-list ref] wrote:
Since commit 06e0d3b89da1 ("kprobes: Make optprobe optimizer
multi-generational and asynchronous") a forced unoptimization can leave
a probe's int3 in the wrong state.  A disabled probe can be freed with
its int3 still in the text, an unhashed probe gets disarmed twice and a
reused probe never gets armed.

Patch 2 relies on patch 1 since it assumes every disabled probe on a
cooling list is already disarmed.
Thanks for updating! This version looks good to me.
Let me pick it.
Changes in v2:
- Patch 1: disarm a disabled probe before choosing the freeing or cooling
  list (Masami)
- Patch 3: keep a reused cooling probe disabled so register_aggr_kprobe()
  arms it only for an enabled new probe (Masami, Sashiko)
- Patch 3: skip the forced unoptimization in add_new_kprobe() for a
  cooling probe, which would otherwise unhash it when the new probe has a
  post_handler
- Link to v1: https://lore.kernel.org/all/20261103-kprobes-optprobe-state-v1-0-6aaac612abe6@columbia.edu/ (local)

---
Mani Tofigh (3):
      kprobes: Disarm disabled optprobe on forced unoptimization
      kprobes: Do not disarm unhashed optprobe on dispatch
      kprobes: Arm reused optprobe on cooling list

 kernel/kprobes.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
---
base-commit: d4d028a7ae6401ce70825a3eb663f0a2dfc49db6
change-id: 20261103-kprobes-optprobe-state-90dbf55b246c

Best regards,
--  
Mani Tofigh [off-list ref]

-- 
Masami Hiramatsu (Google) [off-list ref]
Thread (5 messages) 5 messages, 3 authors, last reply 7d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help