Skip to content

Commit c895f6f

Browse files
hbruecknerborkmann
authored andcommitted
bpf: correct broken uapi for BPF_PROG_TYPE_PERF_EVENT program type
Commit 0515e59 ("bpf: introduce BPF_PROG_TYPE_PERF_EVENT program type") introduced the bpf_perf_event_data structure which exports the pt_regs structure. This is OK for multiple architectures but fail for s390 and arm64 which do not export pt_regs. Programs using them, for example, the bpf selftest fail to compile on these architectures. For s390, exporting the pt_regs is not an option because s390 wants to allow changes to it. For arm64, there is a user_pt_regs structure that covers parts of the pt_regs structure for use by user space. To solve the broken uapi for s390 and arm64, introduce an abstract type for pt_regs and add an asm/bpf_perf_event.h file that concretes the type. An asm-generic header file covers the architectures that export pt_regs today. The arch-specific enablement for s390 and arm64 follows in separate commits. Reported-by: Thomas Richter <tmricht@linux.vnet.ibm.com> Fixes: 0515e59 ("bpf: introduce BPF_PROG_TYPE_PERF_EVENT program type") Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Reviewed-and-tested-by: Thomas Richter <tmricht@linux.vnet.ibm.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 2391f0b commit c895f6f

32 files changed

Lines changed: 47 additions & 5 deletions

File tree

‎arch/alpha/include/uapi/asm/Kbuild‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# UAPI Header export list
22
include include/uapi/asm-generic/Kbuild.asm
3+
4+
generic-y += bpf_perf_event.h

‎arch/arc/include/uapi/asm/Kbuild‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
33

44
generic-y += auxvec.h
55
generic-y += bitsperlong.h
6+
generic-y += bpf_perf_event.h
67
generic-y += errno.h
78
generic-y += fcntl.h
89
generic-y += ioctl.h

‎arch/arm/include/uapi/asm/Kbuild‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ generated-y += unistd-oabi.h
77
generated-y += unistd-eabi.h
88

99
generic-y += bitsperlong.h
10+
generic-y += bpf_perf_event.h
1011
generic-y += errno.h
1112
generic-y += ioctl.h
1213
generic-y += ipcbuf.h

‎arch/blackfin/include/uapi/asm/Kbuild‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
33

44
generic-y += auxvec.h
55
generic-y += bitsperlong.h
6+
generic-y += bpf_perf_event.h
67
generic-y += errno.h
78
generic-y += ioctl.h
89
generic-y += ipcbuf.h

‎arch/c6x/include/uapi/asm/Kbuild‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
33

44
generic-y += auxvec.h
55
generic-y += bitsperlong.h
6+
generic-y += bpf_perf_event.h
67
generic-y += errno.h
78
generic-y += fcntl.h
89
generic-y += ioctl.h

‎arch/cris/include/uapi/asm/Kbuild‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
33

44
generic-y += auxvec.h
55
generic-y += bitsperlong.h
6+
generic-y += bpf_perf_event.h
67
generic-y += errno.h
78
generic-y += fcntl.h
89
generic-y += ioctl.h

‎arch/frv/include/uapi/asm/Kbuild‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# UAPI Header export list
22
include include/uapi/asm-generic/Kbuild.asm
3+
4+
generic-y += bpf_perf_event.h

‎arch/h8300/include/uapi/asm/Kbuild‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
include include/uapi/asm-generic/Kbuild.asm
33

44
generic-y += auxvec.h
5+
generic-y += bpf_perf_event.h
56
generic-y += errno.h
67
generic-y += fcntl.h
78
generic-y += ioctl.h

‎arch/hexagon/include/uapi/asm/Kbuild‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
include include/uapi/asm-generic/Kbuild.asm
33

44
generic-y += auxvec.h
5+
generic-y += bpf_perf_event.h
56
generic-y += errno.h
67
generic-y += fcntl.h
78
generic-y += ioctl.h

‎arch/ia64/include/uapi/asm/Kbuild‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# UAPI Header export list
22
include include/uapi/asm-generic/Kbuild.asm
33

4+
generic-y += bpf_perf_event.h
45
generic-y += kvm_para.h

0 commit comments

Comments
 (0)