tools/bpf: add a test for bpf_get_stack with raw tracepoint prog
authorYonghong Song <yhs@fb.com>
Sun, 29 Apr 2018 05:28:15 +0000 (22:28 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 29 Apr 2018 15:45:54 +0000 (08:45 -0700)
commit173965fbfba596c02fa128966c2a33cb88afcd7f
tree1fc1303c919ac14b3b00564823c056b19e9fcfa4
parent2abe611c5f031f06ab783102e62c0ae9dfd93e80
tools/bpf: add a test for bpf_get_stack with raw tracepoint prog

The test attached a raw_tracepoint program to raw_syscalls/sys_enter.
It tested to get stack for user space, kernel space and user
space with build_id request. It also tested to get user
and kernel stack into the same buffer with back-to-back
bpf_get_stack helper calls.

If jit is not enabled, the user space application will check
to ensure that the kernel function for raw_tracepoint
___bpf_prog_run is part of the stack.

If jit is enabled, we did not have a reliable way to
verify the kernel stack, so just assume the kernel stack
is good when the kernel stack size is greater than 0.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/test_get_stack_rawtp.c [new file with mode: 0644]
tools/testing/selftests/bpf/test_progs.c