History

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.

Hendrik Brueckner committed 8 years ago

Commit c895f6f1 parent 2391f0b32 files · +47 −5Browse files

Showing the changes to include/uapi (2 of 32 files). Show all

Unified · Split

2 files
  1. include/uapi/asm-generic/bpf_perf_event.h +9 −0
  2. include/uapi/linux/bpf_perf_event.h +2 −3
include/uapi/asm-generic/bpf_perf_event.h+9−0
@@ -0,0 +1,9 @@
1#ifndef _UAPI__ASM_GENERIC_BPF_PERF_EVENT_H__
2#define _UAPI__ASM_GENERIC_BPF_PERF_EVENT_H__
3
4#include <linux/ptrace.h>
5
6/* Export kernel pt_regs structure */
7typedef struct pt_regs bpf_user_pt_regs_t;
8
9#endif /* _UAPI__ASM_GENERIC_BPF_PERF_EVENT_H__ */
include/uapi/linux/bpf_perf_event.h+2−3
@@ -8,11 +8,10 @@ · 7 unmodified lines
8#ifndef _UAPI__LINUX_BPF_PERF_EVENT_H__8#ifndef _UAPI__LINUX_BPF_PERF_EVENT_H__
9#define _UAPI__LINUX_BPF_PERF_EVENT_H__9#define _UAPI__LINUX_BPF_PERF_EVENT_H__
10 10
11#include <linux/types.h>11#include <asm/bpf_perf_event.h>
12#include <linux/ptrace.h>
13 12
14struct bpf_perf_event_data {13struct bpf_perf_event_data {
15 struct pt_regs regs;14 bpf_user_pt_regs_t regs;
16 __u64 sample_period;15 __u64 sample_period;
17};16};
18 17

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t