]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Fix build of task_pt_regs test for arm64
authorJean-Philippe Brucker <jean-philippe@linaro.org>
Mon, 6 Sep 2021 16:36:38 +0000 (17:36 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 7 Sep 2021 15:23:19 +0000 (17:23 +0200)
commit3a029e1f3d6e2ee809e85abecce619a48016bd4b
tree148c398b99ac7f954aa7a3b19bc402e9e48c1424
parent49ca6153208f6efc409c1deb82dd5bcbb519d7e1
selftests/bpf: Fix build of task_pt_regs test for arm64

struct pt_regs is not exported to userspace on all archs. arm64 and s390
export "user_pt_regs" instead, which causes build failure at the moment:

  progs/test_task_pt_regs.c:8:16: error: variable has incomplete type 'struct pt_regs'
  struct pt_regs current_regs = {};

Instead of using pt_regs from ptrace.h, use the larger kernel struct
from vmlinux.h directly. Since the test runner task_pt_regs.c does not
have access to the kernel struct definition, copy it into a char array.

Fixes: 576d47bb1a92 ("bpf: selftests: Add bpf_task_pt_regs() selftest")
Suggested-by: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Ilya Leoshkevich <iii@linux.ibm.com>
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Link: https://lore.kernel.org/bpf/20210906163635.302307-1-jean-philippe@linaro.org
tools/testing/selftests/bpf/prog_tests/task_pt_regs.c
tools/testing/selftests/bpf/progs/test_task_pt_regs.c