Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Browse files Browse the repository at this point in the history
Daniel Borkmann says:

====================
pull-request: bpf 2017-12-06

The following pull-request contains BPF updates for your *net* tree.

The main changes are:

1) Fixing broken uapi for BPF tracing programs for s390 and arm64
   architectures due to pt_regs being in-kernel only, and not part
   of uapi right now. A wrapper is added that exports pt_regs in
   an asm-generic way. For arm64 this maps to existing user_pt_regs
   structure and for s390 a user_pt_regs structure exporting the
   beginning of pt_regs is added and uapi-exported, thus fixing the
   BPF issues seen in perf (and BPF selftests), all from Hendrik.
====================

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 committed Dec 7, 2017
2 parents a4abd7a + 037776e commit 195bd52
Show file tree
Hide file tree
Showing 47 changed files with 668 additions and 79 deletions.
2 changes: 2 additions & 0 deletions arch/alpha/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

generic-y += bpf_perf_event.h
1 change: 1 addition & 0 deletions arch/arc/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm

generic-y += auxvec.h
generic-y += bitsperlong.h
generic-y += bpf_perf_event.h
generic-y += errno.h
generic-y += fcntl.h
generic-y += ioctl.h
Expand Down
1 change: 1 addition & 0 deletions arch/arm/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ generated-y += unistd-oabi.h
generated-y += unistd-eabi.h

generic-y += bitsperlong.h
generic-y += bpf_perf_event.h
generic-y += errno.h
generic-y += ioctl.h
generic-y += ipcbuf.h
Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/include/asm/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define __ASM_PERF_EVENT_H

#include <asm/stack_pointer.h>
#include <asm/ptrace.h>

#define ARMV8_PMU_MAX_COUNTERS 32
#define ARMV8_PMU_COUNTER_MASK (ARMV8_PMU_MAX_COUNTERS - 1)
Expand Down Expand Up @@ -79,6 +80,7 @@ struct pt_regs;
extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
extern unsigned long perf_misc_flags(struct pt_regs *regs);
#define perf_misc_flags(regs) perf_misc_flags(regs)
#define perf_arch_bpf_user_pt_regs(regs) &regs->user_regs
#endif

#define perf_arch_fetch_caller_regs(regs, __ip) { \
Expand Down
9 changes: 9 additions & 0 deletions arch/arm64/include/uapi/asm/bpf_perf_event.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0 */
#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__ */
1 change: 1 addition & 0 deletions arch/blackfin/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm

generic-y += auxvec.h
generic-y += bitsperlong.h
generic-y += bpf_perf_event.h
generic-y += errno.h
generic-y += ioctl.h
generic-y += ipcbuf.h
Expand Down
1 change: 1 addition & 0 deletions arch/c6x/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm

generic-y += auxvec.h
generic-y += bitsperlong.h
generic-y += bpf_perf_event.h
generic-y += errno.h
generic-y += fcntl.h
generic-y += ioctl.h
Expand Down
1 change: 1 addition & 0 deletions arch/cris/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm

generic-y += auxvec.h
generic-y += bitsperlong.h
generic-y += bpf_perf_event.h
generic-y += errno.h
generic-y += fcntl.h
generic-y += ioctl.h
Expand Down
2 changes: 2 additions & 0 deletions arch/frv/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

generic-y += bpf_perf_event.h
1 change: 1 addition & 0 deletions arch/h8300/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
include include/uapi/asm-generic/Kbuild.asm

generic-y += auxvec.h
generic-y += bpf_perf_event.h
generic-y += errno.h
generic-y += fcntl.h
generic-y += ioctl.h
Expand Down
1 change: 1 addition & 0 deletions arch/hexagon/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
include include/uapi/asm-generic/Kbuild.asm

generic-y += auxvec.h
generic-y += bpf_perf_event.h
generic-y += errno.h
generic-y += fcntl.h
generic-y += ioctl.h
Expand Down
1 change: 1 addition & 0 deletions arch/ia64/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

generic-y += bpf_perf_event.h
generic-y += kvm_para.h
1 change: 1 addition & 0 deletions arch/m32r/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

generic-y += bpf_perf_event.h
generic-y += kvm_para.h
generic-y += siginfo.h
1 change: 1 addition & 0 deletions arch/m68k/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm

generic-y += auxvec.h
generic-y += bitsperlong.h
generic-y += bpf_perf_event.h
generic-y += errno.h
generic-y += ioctl.h
generic-y += ipcbuf.h
Expand Down
1 change: 1 addition & 0 deletions arch/metag/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm

generic-y += auxvec.h
generic-y += bitsperlong.h
generic-y += bpf_perf_event.h
generic-y += errno.h
generic-y += fcntl.h
generic-y += ioctl.h
Expand Down
1 change: 1 addition & 0 deletions arch/microblaze/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
include include/uapi/asm-generic/Kbuild.asm

generic-y += bitsperlong.h
generic-y += bpf_perf_event.h
generic-y += errno.h
generic-y += fcntl.h
generic-y += ioctl.h
Expand Down
1 change: 1 addition & 0 deletions arch/mips/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

generic-y += bpf_perf_event.h
generic-y += ipcbuf.h
1 change: 1 addition & 0 deletions arch/mn10300/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

generic-y += bpf_perf_event.h
generic-y += siginfo.h
1 change: 1 addition & 0 deletions arch/nios2/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm

generic-y += auxvec.h
generic-y += bitsperlong.h
generic-y += bpf_perf_event.h
generic-y += errno.h
generic-y += fcntl.h
generic-y += ioctl.h
Expand Down
1 change: 1 addition & 0 deletions arch/openrisc/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm

generic-y += auxvec.h
generic-y += bitsperlong.h
generic-y += bpf_perf_event.h
generic-y += errno.h
generic-y += fcntl.h
generic-y += ioctl.h
Expand Down
1 change: 1 addition & 0 deletions arch/parisc/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
include include/uapi/asm-generic/Kbuild.asm

generic-y += auxvec.h
generic-y += bpf_perf_event.h
generic-y += kvm_para.h
generic-y += param.h
generic-y += poll.h
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

generic-y += bpf_perf_event.h
generic-y += param.h
generic-y += poll.h
generic-y += resource.h
Expand Down
1 change: 1 addition & 0 deletions arch/riscv/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm

generic-y += setup.h
generic-y += unistd.h
generic-y += bpf_perf_event.h
generic-y += errno.h
generic-y += fcntl.h
generic-y += ioctl.h
Expand Down
1 change: 1 addition & 0 deletions arch/s390/include/asm/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct pt_regs;
extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
extern unsigned long perf_misc_flags(struct pt_regs *regs);
#define perf_misc_flags(regs) perf_misc_flags(regs)
#define perf_arch_bpf_user_pt_regs(regs) &regs->user_regs

/* Perf pt_regs extension for sample-data-entry indicators */
struct perf_sf_sde_regs {
Expand Down
11 changes: 8 additions & 3 deletions arch/s390/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,14 @@ enum {
*/
struct pt_regs
{
unsigned long args[1];
psw_t psw;
unsigned long gprs[NUM_GPRS];
union {
user_pt_regs user_regs;
struct {
unsigned long args[1];
psw_t psw;
unsigned long gprs[NUM_GPRS];
};
};
unsigned long orig_gpr2;
unsigned int int_code;
unsigned int int_parm;
Expand Down
9 changes: 9 additions & 0 deletions arch/s390/include/uapi/asm/bpf_perf_event.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
#define _UAPI__ASM_BPF_PERF_EVENT_H__

#include <asm/ptrace.h>

typedef user_pt_regs bpf_user_pt_regs_t;

#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */
Loading

0 comments on commit 195bd52

Please sign in to comment.