WSL2-Linux-Kernel/arch/powerpc/include/uapi/asm
Naveen N. Rao b21bd5a4b1 powerpc/bpf: Fix use of user_pt_regs in uapi
Trying to build a .c file that includes <linux/bpf_perf_event.h>:
  $ cat test_bpf_headers.c
  #include <linux/bpf_perf_event.h>

throws the below error:
  /usr/include/linux/bpf_perf_event.h:14:28: error: field ‘regs’ has incomplete type
     14 |         bpf_user_pt_regs_t regs;
	|                            ^~~~

This is because we typedef bpf_user_pt_regs_t to 'struct user_pt_regs'
in arch/powerpc/include/uaps/asm/bpf_perf_event.h, but 'struct
user_pt_regs' is not exposed to userspace.

Powerpc has both pt_regs and user_pt_regs structures. However, unlike
arm64 and s390, we expose user_pt_regs to userspace as just 'pt_regs'.
As such, we should typedef bpf_user_pt_regs_t to 'struct pt_regs' for
userspace.

Within the kernel though, we want to typedef bpf_user_pt_regs_t to
'struct user_pt_regs'.

Remove arch/powerpc/include/uapi/asm/bpf_perf_event.h so that the
uapi/asm-generic version of the header is exposed to userspace.
Introduce arch/powerpc/include/asm/bpf_perf_event.h so that we can
typedef bpf_user_pt_regs_t to 'struct user_pt_regs' for use within the
kernel.

Note that this was not showing up with the bpf selftest build since
tools/include/uapi/asm/bpf_perf_event.h didn't include the powerpc
variant.

Fixes: a6460b03f9 ("powerpc/bpf: Fix broken uapi for BPF_PROG_TYPE_PERF_EVENT")
Cc: stable@vger.kernel.org # v4.20+
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
[mpe: Use typical naming for header include guard]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220627191119.142867-1-naveen.n.rao@linux.vnet.ibm.com
2022-06-29 20:43:04 +10:00
..
Kbuild treewide: Add SPDX license identifier - Kbuild 2019-05-30 11:32:33 -07:00
auxvec.h powerpc/signal: Report minimum signal frame size to userspace via AT_MINSIGSTKSZ 2022-05-19 23:11:26 +10:00
bitsperlong.h
bootx.h
byteorder.h
cputable.h powerpc: Add new HWCAP bits 2020-06-02 20:59:19 +10:00
eeh.h
elf.h powerpc: Remove 'struct ppc64_opd_entry' 2022-02-16 23:25:11 +11:00
epapr_hcalls.h
errno.h powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h 2021-04-17 10:40:51 +10:00
fcntl.h
ioctl.h
ioctls.h
ipcbuf.h
kvm.h KVM: PPC: Book3S HV: Add infrastructure to support 2nd DAWR 2021-02-10 14:31:08 +11:00
kvm_para.h docs: fix broken references to text files 2020-04-20 15:35:59 -06:00
mman.h Revert "powerpc/64s: Remove PROT_SAO support" 2020-08-24 14:12:53 +10:00
msgbuf.h arch: msgbuf.h: make uapi asm/msgbuf.h self-contained 2019-12-04 19:44:14 -08:00
nvram.h
opal-prd.h
papr_pdsm.h powerpc/papr_scm: Implement initial support for injecting smart errors 2022-02-16 23:10:47 +11:00
perf_event.h
perf_regs.h powerpc/perf: Expose instruction and data address registers as part of extended regs 2021-10-12 18:39:02 +11:00
posix_types.h powerpc/32: Remove powerpc specific definition of 'ptrdiff_t' 2021-04-08 21:17:46 +10:00
ps3fb.h
ptrace.h powerpc/watchpoint/ptrace: Introduce PPC_DEBUG_FEATURE_DATA_BP_ARCH_31 2020-09-15 22:13:20 +10:00
sembuf.h arch: sembuf.h: make uapi asm/sembuf.h self-contained 2019-12-04 19:44:14 -08:00
setup.h
shmbuf.h shmbuf.h: add asm/shmbuf.h to UAPI compile-test coverage 2022-02-17 09:09:37 +01:00
sigcontext.h
signal.h powerpc/64: Bump SIGSTKSZ and MINSIGSTKSZ 2022-05-19 23:11:26 +10:00
socket.h
spu_info.h powerpc: Replace GPL boilerplate with SPDX identifiers 2019-11-13 16:58:07 +11:00
stat.h powerpc: use __kernel_{uid,gid}32_t in uapi/asm/stat.h 2022-06-02 17:38:15 +02:00
swab.h
termbits.h termbits.h: Align lines & format 2022-05-19 18:25:26 +02:00
termios.h
tm.h
types.h
ucontext.h
unistd.h
vas-api.h powerpc/vas: Define QoS credit flag to allocate window 2021-06-20 21:58:56 +10:00