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


Groups > linux.kernel > #1710974

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

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: Fwd: struct pt_regs missing in /usr/include/ tree for eBPF program compile
Date 2017-08-14 16:40 +0200
Message-ID <ueoH8-5ij-9@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 2:08 PM, Heiko Carstens
<heiko.carstens@de.ibm.com> wrote:
>
> 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.

On some architectures, pt_regs is definitely part of the uapi, as
we define sigcontext in terms of pt_regs:

arch/cris/include/uapi/asm/sigcontext.h:        struct pt_regs regs;
/* needs to be first */
arch/m32r/include/uapi/asm/sigcontext.h:        struct pt_regs *sc_pt_regs;
arch/microblaze/include/uapi/asm/sigcontext.h:  struct pt_regs regs;
arch/powerpc/include/uapi/asm/sigcontext.h:     struct pt_regs  __user *regs;
arch/tile/include/uapi/asm/sigcontext.h: * struct sigcontext has the
same shape as struct pt_regs,
arch/unicore32/include/uapi/asm/sigcontext.h:   struct pt_regs regs;

On other architectures, they just use the same layout but different names.

arm32 also uses pt_regs in struct kvm_regs, the other ones don't:

arch/arm/include/uapi/asm/kvm.h:        struct pt_regs usr_regs;
 /* R0_usr - R14_usr, PC, CPSR */

> In addition what about compat processes? Most architectures define their
> struct pt_regs with "unsigned long" members, which have different sizes for
> 32/64 bit, while the structure on the kernel stack contains 64 bit
> members. And as far as I know the bpf test cases want to access the kernel
> stack, no? Then this seems to be broken also.

Right.

      Arnd

Back to linux.kernel | Previous | Next — Previous in thread | Next 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