# \[PATCH 3/3\] kprobes: Arm reused optprobe on cooling list

- From: Mani Tofigh via B4 Relay \<devnull+mt4022.columbia.edu@kernel.org\>
- Date: 2026-11-03 18:46:01 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2026/11/17855397
- Thread: https://ratatoskr.run/linux-trace-kernel/2026/11/17855396/t.md

```text
From: Mani Tofigh <redacted>

A new probe that reuses an unused probe still on a cooling list doesn't
fire.  reuse_unused_kprobe() clears DISABLED without arming it, so the
probe has no int3 until it's optimized again, or ever if it can't be
(e.g., it has a post_handler).

Arm a reused cooling probe.  With the fix, it fires.

Fixes: 06e0d3b89da1 ("kprobes: Make optprobe optimizer multi-generational and asynchronous")
Signed-off-by: Mani Tofigh <redacted>
---
 kernel/kprobes.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 84a5f68476eb..59c5689299ce 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -536,6 +536,7 @@ static struct optprobe_generation optprobe_gens[OPTPROBE_GEN_MAX];
 static int optprobe_cur_gen;
 
 static void optimize_kprobe(struct kprobe *p);
+static void __arm_kprobe(struct kprobe *p);
 static struct task_struct *kprobe_optimizer_task;
 static wait_queue_head_t kprobe_optimizer_wait;
 static atomic_t optimizer_state;
@@ -1067,6 +1068,13 @@ static int reuse_unused_kprobe(struct kprobe *ap)
 	if (!kprobe_optready(ap))
 		return -EINVAL;
 
+	if (optprobe_queued_cooling(op)) {
+		/* Already disarmed. It will be optimized again upon finalize */
+		if (!kprobes_all_disarmed)
+			__arm_kprobe(ap);
+		return 0;
+	}
+
 	optimize_kprobe(ap);
 	return 0;
 }

-- 
2.53.0


```
