diff options
| author | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-11-11 23:13:49 +0900 |
|---|---|---|
| committer | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-11-13 17:32:56 +0900 |
| commit | 081f8fba975a2f2361d74e5e34dbc1837599394a (patch) | |
| tree | 95a8fdb144c4ca048ab0e2ef0c5354416b43f28e /tools/perf/scripts/python | |
| parent | c8c1e4096830e3f2deda00661bdecfe06d113460 (diff) | |
kprobes: Do not overwrite jump instruction when re-arming unoptimizing probe
When an optimized probe is temporarily disarmed or disabled,
unoptimize_kprobe() places it on the unoptimizing list, but leaves
the relative jump in text until the optimizer thread runs.
__disarm_kprobe() explicitly skips arch_disarm_kprobe() when
kprobe_queued_unopt(p) is true.
However, if __arm_kprobe() is called before the unoptimization pass
executes, it unconditionally calls arch_arm_kprobe(p), writing a
breakpoint instruction over the first byte of the jump while leaving the
trailing bytes intact. optimize_kprobe(p) then dequeues the probe from
the unoptimizing queue, leaving the jump opcode overwritten with a
breakpoint in text while KPROBE_FLAG_OPTIMIZED remains set.
Skip calling arch_arm_kprobe() in __arm_kprobe() when
kprobe_queued_unopt(p) is true, keeping the existing relative jump intact
while unoptimization is cancelled. If optimize_kprobe() cannot optimize
the probe (e.g. due to a post_handler or disabled optimization), force
unoptimization immediately.
Link: https://lore.kernel.org/all/179440642973.328088.10282643330198602134.stgit@devnote2/
Fixes: 06e0d3b89da1 ("kprobes: Make optprobe optimizer multi-generational and asynchronous")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
