> x86/kprobes: Take a Tasks Trace reader in the optprobe template
>
> The jump-optimized kprobe template calls optimized_callback() from a
> dynamically allocated slot with preemption enabled, and only Tasks RCU
> keeps that slot alive under a task preempted in the callback.  For
> HAVE_RCU_TRAMPOLINE_READERS that means the template must be a Tasks
> Trace reader across the call, so open-code rcu_read_lock_trace() and
> rcu_read_unlock_trace() around it as ftrace_64.S does.  The template
> lives in .rodata and is memcpy()d into each slot without relocation
> processing, so the references to current_task and
> rcu_tasks_trace_srcu_struct are absolute (R_X86_64_32S, relocated for
> KASLR like any other) rather than %rip-relative.  %rax and %rcx have
> already been saved by SAVE_REGS_STRING and are dead after the call.
>
> The slot itself is dynamically allocated text, so the instructions
> before the lock and after the unlock are covered by the irq-exit check.
> 64-bit only; 32-bit x86 does not take part.
>
> Assisted-by: LLM
> Signed-off-by: Josef Bacik <[email protected]>

This looks like a bug fix for the preemption issue introduced when commit
a19b2e3d7839 removed IRQ disabling from optimized kprobes. Should this
include:

  Fixes: a19b2e3d7839 ("kprobes/x86: Remove IRQ disabling from 
ftrace-based/optimized kprobes")


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/35680506278

Reply via email to