Re: [PATCH v2 0/3] kprobes: Fix optprobe state after forced unoptimization
From: Masami Hiramatsu (Google)
Date: Sun Nov 08 2026 - 18:37:20 EST
On Thu, 05 Nov 2026 15:32:11 -0500, Mani Tofigh via B4 Relay <devnull+mt4022.columbia.edu@xxxxxxxxxx> 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@xxxxxxxxxxxx/
>
> ---
> 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 <mt4022@xxxxxxxxxxxx>
>
>
>
--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>