Skip to content

Conversation

olsajiri
Copy link
Contributor

@olsajiri olsajiri commented Oct 2, 2025

No description provided.

Kernel Patches Daemon and others added 5 commits October 1, 2025 09:52
When using bpf_program__attach_kprobe_multi_opts on ARM64 to hook a BPF program
that contains the bpf_get_stackid function, the BPF program fails
to obtain the stack trace and returns -EFAULT.

This is because ftrace_partial_regs omits the configuration of the pstate register,
leaving pstate at the default value of 0. When get_perf_callchain executes,
it uses user_mode(regs) to determine whether it is in kernel mode.
This leads to a misjudgment that the code is in user mode,
so perf_callchain_kernel is not executed and the function returns directly.
As a result, trace->nr becomes 0, and finally -EFAULT is returned.

Therefore, the assignment of the pstate register is added here.

Fixes: b9b55c8 ("tracing: Add ftrace_partial_regs() for converting ftrace_regs to pt_regs")
Closes: https://lore.kernel.org/bpf/[email protected]/
Signed-off-by: Feng Yang <[email protected]>
@olsajiri olsajiri force-pushed the stacktrace_test_ci branch 2 times, most recently from 37d5560 to fe5c502 Compare October 2, 2025 21:22
@olsajiri olsajiri force-pushed the stacktrace_test_ci branch 3 times, most recently from 4c21ee1 to e08c683 Compare October 3, 2025 12:45
@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot force-pushed the bpf-next_base branch 2 times, most recently from 034e8d9 to bd1a434 Compare October 4, 2025 16:30
Adding stacktrace test for kprobe[_multi] probes.

Signed-off-by: Jiri Olsa <[email protected]>
---
test for arm fix posted separately in here:
  https://lore.kernel.org/bpf/[email protected]/
Adding stacktrace test for uprobe[_multi] probes.

Signed-off-by: Jiri Olsa <[email protected]>
@olsajiri olsajiri force-pushed the stacktrace_test_ci branch from e08c683 to ec923f3 Compare October 5, 2025 20:59
@olsajiri olsajiri force-pushed the stacktrace_test_ci branch from c0ceb80 to 62280db Compare October 5, 2025 21:49
@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot force-pushed the bpf-next_base branch 11 times, most recently from c85a7ce to a4b455f Compare October 10, 2025 23:44
@kernel-patches-daemon-bpf
Copy link

Automatically cleaning up stale PR; feel free to reopen if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants