Menglong Dong
0265c1fd91
selftests/bpf: enable fsession_test on riscv64
...
Now that the RISC-V trampoline JIT supports BPF_TRACE_FSESSION, run
the fsession selftest on riscv64 as well as x86_64.
Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn >
Tested-by: Björn Töpel <bjorn@kernel.org >
Acked-by: Björn Töpel <bjorn@kernel.org >
Link: https://lore.kernel.org/r/20260208053311.698352-4-dongml2@chinatelecom.cn
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
Reviewed-by: Pu Lehui <pulehui@huawei.com >
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2026-02-13 14:14:27 -08:00
Leon Hwang
7f10da2133
selftests/bpf: Enable get_func_args and get_func_ip tests on arm64
...
Allow get_func_args, and get_func_ip fsession selftests to run on arm64.
Acked-by: Puranjay Mohan <puranjay@kernel.org >
Tested-by: Puranjay Mohan <puranjay@kernel.org >
Signed-off-by: Leon Hwang <leon.hwang@linux.dev >
Link: https://lore.kernel.org/r/20260131144950.16294-4-leon.hwang@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2026-01-31 13:51:04 -08:00
Menglong Dong
a5533a6eaa
selftests/bpf: test bpf_get_func_* for fsession
...
Test following bpf helper for fsession:
bpf_get_func_arg()
bpf_get_func_arg_cnt()
bpf_get_func_ret()
bpf_get_func_ip()
Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn >
Link: https://lore.kernel.org/r/20260124062008.8657-12-dongml2@chinatelecom.cn
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2026-01-24 18:49:36 -08:00
Daniel Xu
dff96e4f50
bpf: selftests: Fix fentry test kfunc prototypes
...
Some prototypes in progs/get_func_ip_test.c were not in line with how the
actual kfuncs are defined in net/bpf/test_run.c. This causes compilation
errors when kfunc prototypes are generated from BTF.
Fix by aligning with actual kfunc definitions.
Also remove two unused prototypes.
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz >
Link: https://lore.kernel.org/r/1e68870e7626b7b9c6420e65076b307fc404a2f0.1718207789.git.dxu@dxuuu.xyz
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2024-06-12 11:01:30 -07:00
Jiri Olsa
e43163ed1c
selftests/bpf: Add bpf_get_func_ip tests for uprobe on function entry
...
Adding get_func_ip tests for uprobe on function entry that
validates that bpf_get_func_ip returns proper values from
both uprobe and return uprobe.
Tested-by: Alan Maguire <alan.maguire@oracle.com >
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Acked-by: Yonghong Song <yonghong.song@linux.dev >
Link: https://lore.kernel.org/r/20230807085956.2344866-3-jolsa@kernel.org
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org >
2023-08-07 16:42:58 -07:00
Jiri Olsa
738c345b74
selftests/bpf: Fix get_func_ip offset test for CONFIG_X86_KERNEL_IBT
...
With CONFIG_X86_KERNEL_IBT enabled the test for kprobe with offset
won't work because of the extra endbr instruction.
As suggested by Andrii adding CONFIG_X86_KERNEL_IBT detection
and using appropriate offset value based on that.
Also removing test7 program, because it does the same as test6.
Suggested-by: Andrii Nakryiko <andrii@kernel.org >
Acked-by: Andrii Nakryiko <andrii@kernel.org >
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220926153340.1621984-7-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2022-09-26 20:30:40 -07:00
Jiri Olsa
0e253f7e55
bpf: Return value in kprobe get_func_ip only for entry address
...
Changing return value of kprobe's version of bpf_get_func_ip
to return zero if the attach address is not on the function's
entry point.
For kprobes attached in the middle of the function we can't easily
get to the function address especially now with the CONFIG_X86_KERNEL_IBT
support.
If user cares about current IP for kprobes attached within the
function body, they can get it with PT_REGS_IP(ctx).
Suggested-by: Andrii Nakryiko <andrii@kernel.org >
Acked-by: Andrii Nakryiko <andrii@kernel.org >
Acked-by: Martynas Pumputis <m@lambda.lt >
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220926153340.1621984-6-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2022-09-26 20:30:40 -07:00
Jiri Olsa
e3f9bc35ea
libbpf: Allow decimal offset for kprobes
...
Allow to specify decimal offset in SEC macro, like:
SEC("kprobe/bpf_fentry_test7+5")
Add selftest for that.
Suggested-by: Andrii Nakryiko <andrii@kernel.org >
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Reviewed-by: Alan Maguire <alan.maguire@oracle.com >
Tested-by: Alan Maguire <alan.maguire@oracle.com >
Link: https://lore.kernel.org/bpf/20210721215810.889975-3-jolsa@kernel.org
2021-07-22 20:09:16 -07:00
Jiri Olsa
8237e75420
selftests/bpf: Add test for bpf_get_func_ip in kprobe+offset probe
...
Adding test for bpf_get_func_ip in kprobe+ofset probe.
Because of the offset value it's arch specific, enabling
the new test only for x86_64 architecture.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
Link: https://lore.kernel.org/bpf/20210714094400.396467-9-jolsa@kernel.org
2021-07-15 17:59:23 -07:00
Jiri Olsa
5d8b583d04
selftests/bpf: Add test for bpf_get_func_ip helper
...
Adding test for bpf_get_func_ip helper for fentry, fexit,
kprobe, kretprobe and fmod_ret programs.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
Link: https://lore.kernel.org/bpf/20210714094400.396467-6-jolsa@kernel.org
2021-07-15 17:59:14 -07:00