linux-stable/arch
Naveen N. Rao fe6618cf88 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:54:46 +02:00
..
alpha alpha: fix alloc_zeroed_user_highpage_movable() 2022-06-09 10:29:51 +02:00
arc ARC: remove redundant READ_ONCE() in cmpxchg loop 2022-04-18 14:47:05 -07:00
arm ARM: dts: bcm2711-rpi-400: Fix GPIO line names 2022-06-29 09:04:43 +02:00
arm64 arm64: dts: exynos: Correct UART clocks on Exynos7885 2022-06-29 09:04:42 +02:00
csky csky: patch_text: Fixup last cpu should be master 2022-06-09 10:30:50 +02:00
h8300 Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2022-04-01 19:57:03 -07:00
hexagon ptrace: Cleanups for v5.18 2022-03-28 17:29:53 -07:00
ia64 vmcore: convert copy_oldmem_page() to take an iov_iter 2022-06-29 09:04:36 +02:00
m68k m68knommu: fix undefined reference to `mach_get_rtc_pll' 2022-06-14 18:45:03 +02:00
microblaze Kbuild updates for v5.18 2022-03-31 11:59:03 -07:00
mips vmcore: convert copy_oldmem_page() to take an iov_iter 2022-06-29 09:04:36 +02:00
nios2 nios2: use fallback for random_get_entropy() instead of zero 2022-05-30 09:24:05 +02:00
openrisc openrisc: start CPU timer early in boot 2022-06-09 10:29:44 +02:00
parisc parisc/unaligned: Fix emulate_ldw() breakage 2022-07-07 17:54:46 +02:00
powerpc powerpc/bpf: Fix use of user_pt_regs in uapi 2022-07-07 17:54:46 +02:00
riscv vmcore: convert copy_oldmem_page() to take an iov_iter 2022-06-29 09:04:36 +02:00
s390 s390/archrandom: simplify back to earlier design and initialize earlier 2022-07-07 17:54:44 +02:00
sh vmcore: convert copy_oldmem_page() to take an iov_iter 2022-06-29 09:04:36 +02:00
sparc signal: Deliver SIGTRAP on perf event asynchronously if blocked 2022-06-09 10:30:00 +02:00
um um: line: Use separate IRQs per line 2022-06-14 18:45:13 +02:00
x86 vmcore: convert copy_oldmem_page() to take an iov_iter 2022-06-29 09:04:36 +02:00
xtensa xtensa: Fix refcount leak bug in time.c 2022-06-29 09:04:40 +02:00
.gitignore
Kconfig vmalloc: replace VM_NO_HUGE_VMAP with VM_ALLOW_HUGE_VMAP 2022-04-19 12:08:57 -07:00