diff options
| author | hongao <hongao@uniontech.com> | 2026-01-15 10:38:03 +0800 |
|---|---|---|
| committer | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-01-20 23:53:07 +0900 |
| commit | f76d1c41b609b3e8f727fe681b7dd36bab71e3c3 (patch) | |
| tree | 3d6a170082cd5a34170b7b6545eceb414330fa5f /kernel | |
| parent | 0f61b1860cc3f52aef9036d7235ed1f017632193 (diff) | |
| download | linux-f76d1c41b609b3e8f727fe681b7dd36bab71e3c3.tar.gz linux-f76d1c41b609b3e8f727fe681b7dd36bab71e3c3.zip | |
kprobes: retry blocked optprobe in do_free_cleaned_kprobes
Once the aggrprobe is fully reverted in do_free_cleaned_kprobes(), retry
optimize_kprobe() on that sibling so it can return to OPTIMIZED.
Also remove the stale comment in __disarm_kprobe().
Link: https://lore.kernel.org/all/349359900266B25F+20260115023804.3951960-2-hongao@uniontech.com/
Signed-off-by: hongao <hongao@uniontech.com>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/kprobes.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index ab8f9fc1f0d1..1bd84d3b4817 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -516,6 +516,7 @@ static LIST_HEAD(freeing_list); static void kprobe_optimizer(struct work_struct *work); static DECLARE_DELAYED_WORK(optimizing_work, kprobe_optimizer); +static void optimize_kprobe(struct kprobe *p); #define OPTIMIZE_DELAY 5 /* @@ -593,6 +594,17 @@ static void do_free_cleaned_kprobes(void) */ continue; } + + /* + * The aggregator was holding back another probe while it sat on the + * unoptimizing/freeing lists. Now that the aggregator has been fully + * reverted we can safely retry the optimization of that sibling. + */ + + struct kprobe *_p = get_optimized_kprobe(op->kp.addr); + if (unlikely(_p)) + optimize_kprobe(_p); + free_aggr_kprobe(&op->kp); } } @@ -1002,12 +1014,6 @@ static void __disarm_kprobe(struct kprobe *p, bool reopt) if (unlikely(_p) && reopt) optimize_kprobe(_p); } - /* - * TODO: Since unoptimization and real disarming will be done by - * the worker thread, we can not check whether another probe are - * unoptimized because of this probe here. It should be re-optimized - * by the worker thread. - */ } #else /* !CONFIG_OPTPROBES */ |
