Alexei Starovoitov
7edc3fcbf9
selftest/bpf: Add a test that reads various addresses.
...
Add a function to bpf_testmod that returns invalid kernel and user addresses.
Then attach an fexit program to that function that tries to read
memory through these addresses.
This logic checks that bpf_probe_read_kernel and BPF_PROBE_MEM logic is sane.
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
Acked-by: Daniel Borkmann <daniel@iogearbox.net >
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net >
2021-12-16 21:41:13 +01:00
Hou Tao
fa7f17d066
bpf/selftests: Add test for writable bare tracepoint
...
Add a writable bare tracepoint in bpf_testmod module, and
trigger its calling when reading /sys/kernel/bpf_testmod
with a specific buffer length. The reading will return
the value in writable context if the early return flag
is enabled in writable context.
Signed-off-by: Hou Tao <houtao1@huawei.com >
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Acked-by: Andrii Nakryiko <andrii@kernel.org >
Link: https://lore.kernel.org/bpf/20211004094857.30868-4-hotforest@gmail.com
2021-10-08 13:22:57 -07:00
Qais Yousef
407be92206
selftests: bpf: Add a new test for bare tracepoints
...
Reuse module_attach infrastructure to add a new bare tracepoint to check
we can attach to it as a raw tracepoint.
Signed-off-by: Qais Yousef <qais.yousef@arm.com >
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
Acked-by: Yonghong Song <yhs@fb.com >
Link: https://lore.kernel.org/bpf/20210119122237.2426878-3-qais.yousef@arm.com
2021-01-20 14:14:05 -08:00
Andrii Nakryiko
2e33f831fc
selftests/bpf: Add set_attach_target() API selftest for module target
...
Add test for bpf_program__set_attach_target() API, validating it can find
kernel module fentry target.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net >
Link: https://lore.kernel.org/bpf/20201211215825.3646154-3-andrii@kernel.org
2020-12-14 16:39:42 +01:00
Andrii Nakryiko
1e38abefcf
selftests/bpf: Add fentry/fexit/fmod_ret selftest for kernel module
...
Add new selftest checking attachment of fentry/fexit/fmod_ret (and raw
tracepoint ones for completeness) BPF programs to kernel module function.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
Link: https://lore.kernel.org/bpf/20201203204634.1325171-15-andrii@kernel.org
2020-12-03 17:38:21 -08:00