[PATCH powerpc] powerpc/bpf: Fix use of user_pt_regs in uapi

Naveen N. Rao naveen.n.rao at linux.vnet.ibm.com
Sat Jun 18 00:34:04 AEST 2022


This is a partial revert of commit a6460b03f945ee ("powerpc/bpf: Fix
broken uapi for BPF_PROG_TYPE_PERF_EVENT").

Unlike x86, powerpc has both pt_regs and user_pt_regs structures. As
such, we still need to override perf_arch_bpf_user_pt_regs() so that the
correct user_regs structure is used.

However, unlike arm64 and s390, we expose user_pt_regs to userspace as
just 'pt_regs'. Due to this, trying to #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;
	|                            ^~~~

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.

Fix this by removing arch/powerpc/include/uapi/asm/bpf_perf_event.h,
allowing fallback to the asm-generic version.

Fixes: a6460b03f945ee ("powerpc/bpf: Fix broken uapi for BPF_PROG_TYPE_PERF_EVENT")
Cc: stable at vger.kernel.org # v4.20+
Signed-off-by: Naveen N. Rao <naveen.n.rao at linux.vnet.ibm.com>
---
 arch/powerpc/include/uapi/asm/bpf_perf_event.h | 9 ---------
 1 file changed, 9 deletions(-)
 delete mode 100644 arch/powerpc/include/uapi/asm/bpf_perf_event.h

diff --git a/arch/powerpc/include/uapi/asm/bpf_perf_event.h b/arch/powerpc/include/uapi/asm/bpf_perf_event.h
deleted file mode 100644
index 5e1e648aeec4c8..00000000000000
--- a/arch/powerpc/include/uapi/asm/bpf_perf_event.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
-#define _UAPI__ASM_BPF_PERF_EVENT_H__
-
-#include <asm/ptrace.h>
-
-typedef struct user_pt_regs bpf_user_pt_regs_t;
-
-#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */

base-commit: bcd1c02813b8ab4ae019c65ffb716c9f579868e7
-- 
2.36.1



More information about the Linuxppc-dev mailing list