linux-stable/arch/powerpc/include/uapi/asm
Naveen N. Rao 213c550deb powerpc/bpf: Fix use of user_pt_regs in uapi
commit b21bd5a4b1 upstream.

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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:52:15 +02:00
..
auxvec.h
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
epapr_hcalls.h
errno.h powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h 2021-05-11 14:47:35 +02:00
fcntl.h
ioctl.h
ioctls.h
ipcbuf.h
Kbuild treewide: Add SPDX license identifier - Kbuild 2019-05-30 11:32:33 -07:00
kvm.h KVM: PPC: Book3S HV: Save/restore new PMU registers 2020-07-22 21:56:41 +10: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: Add support for fetching nvdimm 'fuel-gauge' metric 2020-07-31 22:55:28 +10:00
perf_event.h
perf_regs.h powerpc/perf: Add extended regs support for power10 platform 2020-08-17 13:11:22 +10:00
posix_types.h
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 y2038: ipc: remove __kernel_time_t reference from headers 2019-11-15 14:38:28 +01:00
sigcontext.h
signal.h
socket.h socket: Rename SO_RCVTIMEO/ SO_SNDTIMEO with _OLD suffixes 2019-02-03 11:17:31 -08:00
spu_info.h powerpc: Replace GPL boilerplate with SPDX identifiers 2019-11-13 16:58:07 +11:00
stat.h y2038: stat: avoid 'time_t' in 'struct stat' 2019-11-15 14:38:28 +01:00
swab.h
termbits.h
termios.h
tm.h
types.h
ucontext.h
unistd.h powerpc: generate uapi header and system call table files 2018-12-21 14:46:50 +11:00
vas-api.h powerpc/vas: Include linux/types.h in uapi/asm/vas-api.h 2020-04-22 20:02:14 +10:00