[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210303064239.GC1913@DESKTOP-TDPLP67.localdomain>
Date: Wed, 3 Mar 2021 12:12:39 +0530
From: "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>
To: Yonghong Song <yhs@...com>
Cc: Jiri Olsa <jolsa@...hat.com>,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
Jiri Olsa <jolsa@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andriin@...com>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Toke Høiland-Jørgensen <toke@...hat.com>,
Yauheni Kaliuta <ykaliuta@...hat.com>
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix test_attach_probe for
powerpc uprobes
On 2021/03/02 09:19AM, Yonghong Song wrote:
>
>
> On 3/2/21 3:14 AM, Jiri Olsa wrote:
> > On Mon, Mar 01, 2021 at 04:34:24PM -0800, Andrii Nakryiko wrote:
> > > On Mon, Mar 1, 2021 at 11:11 AM Jiri Olsa <jolsa@...nel.org> wrote:
> > > >
> > > > When testing uprobes we the test gets GEP (Global Entry Point)
> > > > address from kallsyms, but then the function is called locally
> > > > so the uprobe is not triggered.
> > > >
> > > > Fixing this by adjusting the address to LEP (Local Entry Point)
> > > > for powerpc arch.
> > > >
> > > > Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> > > > ---
> > > > .../selftests/bpf/prog_tests/attach_probe.c | 18 +++++++++++++++++-
> > > > 1 file changed, 17 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/tools/testing/selftests/bpf/prog_tests/attach_probe.c b/tools/testing/selftests/bpf/prog_tests/attach_probe.c
> > > > index a0ee87c8e1ea..c3cfb48d3ed0 100644
> > > > --- a/tools/testing/selftests/bpf/prog_tests/attach_probe.c
> > > > +++ b/tools/testing/selftests/bpf/prog_tests/attach_probe.c
> > > > @@ -2,6 +2,22 @@
> > > > #include <test_progs.h>
> > > > #include "test_attach_probe.skel.h"
> > > >
> > > > +#if defined(__powerpc64__)
> > > > +/*
> > > > + * We get the GEP (Global Entry Point) address from kallsyms,
> > > > + * but then the function is called locally, so we need to adjust
> > > > + * the address to get LEP (Local Entry Point).
> > > > + */
> > > > +#define LEP_OFFSET 8
> > > > +
> > > > +static ssize_t get_offset(ssize_t offset)
> > >
> > > if we mark this function __weak global, would it work as is? Would it
> > > get an address of a global entry point? I know nothing about this GEP
> > > vs LEP stuff, interesting :)
> >
> > you mean get_base_addr? it's already global
> >
> > all the calls to get_base_addr within the object are made
> > to get_base_addr+0x8
> >
> > 00000000100350c0 <test_attach_probe>:
> > ...
> > 100350e0: 59 fd ff 4b bl 10034e38 <get_base_addr+0x8>
> > ...
> > 100358a8: 91 f5 ff 4b bl 10034e38 <get_base_addr+0x8>
> >
> >
> > I'm following perf fix we had for similar issue:
> > 7b6ff0bdbf4f perf probe ppc64le: Fixup function entry if using kallsyms lookup
> >
> > I'll get more info on that
>
> Thanks. The patch
> 7b6ff0bdbf4f perf probe ppc64le: Fixup function entry if using kallsyms
> lookup
> talked about offset + 8 for kernel symbols.
> I guess uprobe symbol might be in the same situation if using the
> same compilation mechanism as kernel. But it would be good
> to get confirmation from ppc people.
Yes, this is part of the ELF V2 ABI, so it applies to both kernel and
userspace.
- Naveen
Powered by blists - more mailing lists