[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aM8oBvEJoR56w2Dk@krava>
Date: Sun, 21 Sep 2025 00:17:42 +0200
From: Jiri Olsa <olsajiri@...il.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>,
Will Deacon <will@...nel.org>
Cc: Feng Yang <yangfeng59949@....com>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>, Eduard <eddyz87@...il.com>,
Song Liu <song@...nel.org>, Yonghong Song <yonghong.song@...ux.dev>,
KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>,
Hao Luo <haoluo@...gle.com>, bpf <bpf@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-trace-kernel <linux-trace-kernel@...r.kernel.org>,
Masami Hiramatsu <mhiramat@...nel.org>
Subject: Re: [BUG] Failed to obtain stack trace via bpf_get_stackid on ARM64
architecture
On Fri, Sep 19, 2025 at 07:56:20PM -0700, Alexei Starovoitov wrote:
> On Fri, Sep 19, 2025 at 12:19 AM Feng Yang <yangfeng59949@....com> wrote:
> >
> > When I use bpf_program__attach_kprobe_multi_opts to hook a BPF program that contains the bpf_get_stackid function on the arm64 architecture,
> > I find that the stack trace cannot be obtained. The trace->nr in __bpf_get_stackid is 0, and the function returns -EFAULT.
> >
> > For example:
> > diff --git a/tools/testing/selftests/bpf/progs/kprobe_multi.c b/tools/testing/selftests/bpf/progs/kprobe_multi.c
> > index 9e1ca8e34913..844fa88cdc4c 100644
> > --- a/tools/testing/selftests/bpf/progs/kprobe_multi.c
> > +++ b/tools/testing/selftests/bpf/progs/kprobe_multi.c
> > @@ -36,6 +36,15 @@ __u64 kretprobe_test6_result = 0;
> > __u64 kretprobe_test7_result = 0;
> > __u64 kretprobe_test8_result = 0;
> >
> > +typedef __u64 stack_trace_t[2];
> > +
> > +struct {
> > + __uint(type, BPF_MAP_TYPE_STACK_TRACE);
> > + __uint(max_entries, 1024);
> > + __type(key, __u32);
> > + __type(value, stack_trace_t);
> > +} stacks SEC(".maps");
> > +
> > static void kprobe_multi_check(void *ctx, bool is_return)
> > {
> > if (bpf_get_current_pid_tgid() >> 32 != pid)
> > @@ -100,7 +109,9 @@ int test_kretprobe(struct pt_regs *ctx)
> > SEC("kprobe.multi")
> > int test_kprobe_manual(struct pt_regs *ctx)
> > {
> > + int id = bpf_get_stackid(ctx, &stacks, 0);
>
> ftrace_partial_regs() supposed to work on x86 and arm64,
> but since multi-kprobe is the only user...
> I suspect the arm64 implementation wasn't really tested.
> Or maybe there is some other issue.
>
> Masami, Jiri,
> thoughts?
hi,
I did quick test for kprobe multi and I can reproduce the issue
on arm64 with ci:
https://github.com/kernel-patches/bpf/pull/9809
but can't really tell what's missing on arm side.. cc-ing Will
thanks,
jirka
Powered by blists - more mailing lists