]> 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)
commit93ecbc4d71078cdc82d5528a0551e8a793569c86
tree148c398b99ac7f954aa7a3b19bc402e9e48c1424
parent8f78f952b66648de1fa3d7401102f84a11f04a48
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: 3b4edce12c31 ("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