summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/loop1.c
diff options
context:
space:
mode:
authorIlya Leoshkevich2019-07-11 16:29:29 +0200
committerDaniel Borkmann2019-07-12 15:38:14 +0200
commit7cd04535abc95c50ba9bfa48efc76274b63c70f5 (patch)
tree93c528eba51d88121b8cda494171e2ec7bbd67a7 /tools/testing/selftests/bpf/progs/loop1.c
parentselftests/bpf: fix s930 -> s390 typo (diff)
downloadkernel-qcow2-linux-7cd04535abc95c50ba9bfa48efc76274b63c70f5.tar.gz
kernel-qcow2-linux-7cd04535abc95c50ba9bfa48efc76274b63c70f5.tar.xz
kernel-qcow2-linux-7cd04535abc95c50ba9bfa48efc76274b63c70f5.zip
selftests/bpf: make PT_REGS_* work in userspace
Right now, on certain architectures, these macros are usable only with kernel headers. This patch makes it possible to use them with userspace headers and, as a consequence, not only in BPF samples, but also in BPF selftests. On s390, provide the forward declaration of struct pt_regs and cast it to user_pt_regs in PT_REGS_* macros. This is necessary, because instead of the full struct pt_regs, s390 exposes only its first member user_pt_regs to userspace, and bpf_helpers.h is used with both userspace (in selftests) and kernel (in samples) headers. It was added in commit 466698e654e8 ("s390/bpf: correct broken uapi for BPF_PROG_TYPE_PERF_EVENT program type"). Ditto on arm64. On x86, provide userspace versions of PT_REGS_* macros. Unlike s390 and arm64, x86 provides struct pt_regs to both userspace and kernel, however, with different member names. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Andrii Nakryiko <andriin@fb.com> Reviewed-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/loop1.c')
0 files changed, 0 insertions, 0 deletions