]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
bpf: correct broken uapi for BPF_PROG_TYPE_PERF_EVENT program type
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Mon, 4 Dec 2017 09:56:44 +0000 (10:56 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 5 Dec 2017 14:02:40 +0000 (15:02 +0100)
commitc895f6f703ad7dd2f99e751d9884b0aa5d0eea25
tree38c78d2344e471e1e926c893120f16015a405b26
parent2391f0b4808e3d5af348324d69f5f45c56a26836
bpf: correct broken uapi for BPF_PROG_TYPE_PERF_EVENT program type

Commit 0515e5999a466dfe ("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: 0515e5999a466dfe ("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>
32 files changed:
arch/alpha/include/uapi/asm/Kbuild
arch/arc/include/uapi/asm/Kbuild
arch/arm/include/uapi/asm/Kbuild
arch/blackfin/include/uapi/asm/Kbuild
arch/c6x/include/uapi/asm/Kbuild
arch/cris/include/uapi/asm/Kbuild
arch/frv/include/uapi/asm/Kbuild
arch/h8300/include/uapi/asm/Kbuild
arch/hexagon/include/uapi/asm/Kbuild
arch/ia64/include/uapi/asm/Kbuild
arch/m32r/include/uapi/asm/Kbuild
arch/m68k/include/uapi/asm/Kbuild
arch/metag/include/uapi/asm/Kbuild
arch/microblaze/include/uapi/asm/Kbuild
arch/mips/include/uapi/asm/Kbuild
arch/mn10300/include/uapi/asm/Kbuild
arch/nios2/include/uapi/asm/Kbuild
arch/openrisc/include/uapi/asm/Kbuild
arch/parisc/include/uapi/asm/Kbuild
arch/powerpc/include/uapi/asm/Kbuild
arch/riscv/include/uapi/asm/Kbuild
arch/score/include/uapi/asm/Kbuild
arch/sh/include/uapi/asm/Kbuild
arch/sparc/include/uapi/asm/Kbuild
arch/tile/include/uapi/asm/Kbuild
arch/unicore32/include/uapi/asm/Kbuild
arch/x86/include/uapi/asm/Kbuild
arch/xtensa/include/uapi/asm/Kbuild
include/linux/perf_event.h
include/uapi/asm-generic/bpf_perf_event.h [new file with mode: 0644]
include/uapi/linux/bpf_perf_event.h
kernel/events/core.c