Commit 779212a
committed
selftests/bpf: Fix uprobe tests in attach_probe on arm 32-bit
With test_progs compiled with ARM THUMB insns, trigger_func*() used for
testing uprobes have odd (LSB set) entry points due to interworking. This
fails alignment check first, then due to uprobe unsupported for THUMB in
prepare_uprobe() -> arch_uprobe_analyze_insn() -> arm_probes_decode_insn().
First fix by setting trigger_func*() as ARM insns and rely on interworking
enabled by default. Doesn't work on Debian bookworm target because insn kernel-patches#1
of funcs patched to 'UDF kernel-patches#25' which causes "Illegal instruction". Patched
by dynamic loader? Kernel somehow?
__attribute__((target("arm")))
Works to compile all test_progs with gcc -marm, or just attach_probe.c.
Change Makefile to compile prog_tests/attach_probe.c with '-marm' to avoid
using THUMB insns, with expected tests passing:
kernel-patches#8/1 attach_probe/manual-default:OK
kernel-patches#8/2 attach_probe/manual-legacy:OK
kernel-patches#8/3 attach_probe/manual-perf:OK
kernel-patches#8/4 attach_probe/manual-link:OK
kernel-patches#8/5 attach_probe/auto:OK
kernel-patches#8/6 attach_probe/kprobe-sleepable:OK
kernel-patches#8/8 attach_probe/uprobe-sleepable:OK
kernel-patches#8/9 attach_probe/uprobe-ref_ctr:OK
kernel-patches#8/10 attach_probe/uprobe-long_name:OK
kernel-patches#8/11 attach_probe/kprobe-long_name:OK
kernel-patches#8 attach_probe:OK
Note that attach_probe/uprobe-lib will still fail since it tries to attach
a uprobe to the system libc.so, which is compiled for THUMB:
test_attach_probe:PASS:skel_open 0 nsec
test_attach_probe:PASS:skel_load 0 nsec
test_attach_probe:PASS:check_bss 0 nsec
test_attach_probe:PASS:uprobe_ref_ctr_cleanup 0 nsec
libbpf: prog 'handle_uprobe_byname2': failed to create uprobe '/lib/arm-linux-gnueabihf/libc.so.6:0x528e1' perf event: -EINVAL
test_uprobe_lib:FAIL:attach_uprobe_byname2 unexpected error: -22
kernel-patches#8/7 attach_probe/uprobe-lib:FAIL
kernel-patches#8 attach_probe:FAIL
Also compile other source files and binary with same issue using "-marm":
bpf_cookie.c
fill_link_info.c
task_pt_regs.test.c
uprobe_autoattach.c (also tries libc.so attach)
usdt.c
uprobe_multi
Signed-off-by: Tony Ambardar <[email protected]>1 parent 75c3a4b commit 779212a
1 file changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
860 | 860 | | |
861 | 861 | | |
862 | 862 | | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
863 | 872 | | |
864 | 873 | | |
865 | 874 | | |
| |||
0 commit comments