Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1718041

Re: Fwd: struct pt_regs missing in /usr/include/ tree for eBPF program compile

From Alexei Starovoitov <alexei.starovoitov@gmail.com>
Newsgroups linux.kernel
Subject Re: Fwd: struct pt_regs missing in /usr/include/ tree for eBPF program compile
Date 2017-08-23 07:10 +0200
Message-ID <uhw5r-4Ik-1@gated-at.bofh.it> (permalink)
References <ua00G-KN-13@gated-at.bofh.it> <ua00G-KN-11@gated-at.bofh.it> <uaMI2-iG-13@gated-at.bofh.it> <uaMI2-iG-11@gated-at.bofh.it> <uemlX-3Zn-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Aug 14, 2017 at 02:08:07PM +0200, Heiko Carstens wrote:
> > Now, I would like to avoid going down that road to pull
> > in kernel internal headers into test_verifier.c, could
> > we instead add a bpf_ptregs.h helper in tools/testing/selftests/bpf/,
> > where s390 and arm64 would put a definition to fallback when
> > otherwise not available? Admittedly, it's a bit of a hack
> > if exporting them is not an option, but 'normal' tracing
> > progs would consult kernel headers anyway. Thoughts?
>
> I really don't think that struct pt_regs is part of uapi and should be
> exported. We did change the layout of the pt_regs structure more than once
> and would like to be able to do so in the future as well.

I think Daniel's suggestion above it the best solution and doesn't
prevent future modification to pt_regs on s390.

> We could add the hack you outlined above, but I'd like to have the same API
> for all architectures. Otherwise we keep adding special cases for
> architectures which don't export pt_regs via uapi (which I think is wrong).

I don't see any other choice but to make this hack for s390/arm64
The programs need to be able to access the registers in the format that
kernel keeps, since the programs are attached to kprobe and perf_events
and are walking in-kernel data structures.
It's already well understood that kprobe+bpf is unstable api, so having
pt_regs being unstable on s390/arm64 doesn't make it any worse.

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: Fwd: struct pt_regs missing in /usr/include/ tree for eBPF  program compile Heiko Carstens <heiko.carstens@de.ibm.com> - 2017-08-14 14:10 +0200
  Re: Fwd: struct pt_regs missing in /usr/include/ tree for eBPF  program compile Arnd Bergmann <arnd@arndb.de> - 2017-08-14 16:40 +0200
  Re: Fwd: struct pt_regs missing in /usr/include/ tree for eBPF  program compile Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2017-08-23 07:10 +0200

csiph-web