Thread (13 messages) 13 messages, 3 authors, 2021-12-23

Re: [PATCH bpf-next] selftests/bpf: Fix building error when using userspace pt_regs

From: Andrii Nakryiko <hidden>
Date: 2021-12-16 04:06:40
Also in: bpf, linux-kselftest, lkml

On Tue, Dec 14, 2021 at 5:54 AM Pu Lehui [off-list ref] wrote:
When building bpf selftests on arm64, the following error will occur:

progs/loop2.c:20:7: error: incomplete definition of type 'struct
user_pt_regs'

Some archs, like arm64 and riscv, use userspace pt_regs in
bpf_tracing.h, which causes build failure when bpf prog use
macro in bpf_tracing.h. So let's use vmlinux.h directly.
We could probably also extend bpf_tracing.h to work with
kernel-defined pt_regs, just like we do for x86 (see __KERNEL__ and
__VMLINUX_H__ checks). It's more work, but will benefit other end
users, not just selftests.
Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
 tools/testing/selftests/bpf/progs/loop1.c     |  8 ++------
 tools/testing/selftests/bpf/progs/loop2.c     |  8 ++------
 tools/testing/selftests/bpf/progs/loop3.c     |  8 ++------
 tools/testing/selftests/bpf/progs/loop6.c     | 20 ++++++-------------
 .../selftests/bpf/progs/test_overhead.c       |  8 ++------
 .../selftests/bpf/progs/test_probe_user.c     |  6 +-----
 6 files changed, 15 insertions(+), 43 deletions(-)
[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help