[PATCH v2 0/2] bpf, x86/unwind/orc: Support reliable unwinding through BPF stack frames

Josh Poimboeuf posted 2 patches 2 weeks, 1 day ago
arch/x86/kernel/unwind_orc.c | 39 +++++++++++++++++++++++++-----------
arch/x86/net/bpf_jit_comp.c  | 12 +++++++++++
include/linux/bpf.h          |  3 +++
kernel/bpf/core.c            | 16 +++++++++++++++
4 files changed, 58 insertions(+), 12 deletions(-)
[PATCH v2 0/2] bpf, x86/unwind/orc: Support reliable unwinding through BPF stack frames
Posted by Josh Poimboeuf 2 weeks, 1 day ago
Fix livepatch stalls which may be seen when a task is blocked with BPF
JIT on its kernel stack.

Changes since v1 (https://lore.kernel.org/cover.1764699074.git.jpoimboe@kernel.org):
- fix NULL ptr deref in __arch_prepare_bpf_trampoline()

Josh Poimboeuf (2):
  bpf: Add bpf_has_frame_pointer()
  x86/unwind/orc: Support reliable unwinding through BPF stack frames

 arch/x86/kernel/unwind_orc.c | 39 +++++++++++++++++++++++++-----------
 arch/x86/net/bpf_jit_comp.c  | 12 +++++++++++
 include/linux/bpf.h          |  3 +++
 kernel/bpf/core.c            | 16 +++++++++++++++
 4 files changed, 58 insertions(+), 12 deletions(-)

-- 
2.51.1
Re: [PATCH v2 0/2] bpf, x86/unwind/orc: Support reliable unwinding through BPF stack frames
Posted by Jiri Olsa 2 weeks, 1 day ago
On Wed, Dec 03, 2025 at 07:32:14PM -0800, Josh Poimboeuf wrote:
> Fix livepatch stalls which may be seen when a task is blocked with BPF
> JIT on its kernel stack.
> 
> Changes since v1 (https://lore.kernel.org/cover.1764699074.git.jpoimboe@kernel.org):
> - fix NULL ptr deref in __arch_prepare_bpf_trampoline()
> 
> Josh Poimboeuf (2):
>   bpf: Add bpf_has_frame_pointer()
>   x86/unwind/orc: Support reliable unwinding through BPF stack frames
> 

tried with bpftrace and it seems to go over bpf_prog properly
in this case:

        bpf_prog_2beb79c650d605dd_fentry_bpf_testmod_bpf_kfunc_common_test_1+320
        bpf_trampoline_354334973728+60
        bpf_kfunc_common_test+9
        bpf_prog_f837cdd29a0519b9_test1+25
        trace_call_bpf+345
        kprobe_perf_func+76
        aggr_pre_handler+72
        kprobe_ftrace_handler+361
        drm_core_init+202
        bpf_fentry_test1+9
        bpf_prog_test_run_tracing+357
        __sys_bpf+2263
        __x64_sys_bpf+33
        do_syscall_64+134
        entry_SYSCALL_64_after_hwframe+118

Reviewed-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka