Commit 644844e
libbpf: Fix event name too long error
When the binary path is excessively long, the generated probe_name in libbpf
exceeds the kernel's MAX_EVENT_NAME_LEN limit (64 bytes).
This causes legacy uprobe event attachment to fail with error code -22.
Before Fix:
./test_progs -t attach_probe/kprobe-long_name
......
libbpf: failed to add legacy kprobe event for 'bpf_kfunc_looooooooooooooooooooooooooooooong_name+0x0': -EINVAL
libbpf: prog 'handle_kprobe': failed to create kprobe 'bpf_kfunc_looooooooooooooooooooooooooooooong_name+0x0' perf event: -EINVAL
test_attach_kprobe_long_event_name:FAIL:attach_kprobe_long_event_name unexpected error: -22
test_attach_probe:PASS:uprobe_ref_ctr_cleanup 0 nsec
#13/11 attach_probe/kprobe-long_name:FAIL
#13 attach_probe:FAIL
./test_progs -t attach_probe/uprobe-long_name
......
libbpf: failed to add legacy uprobe event for /root/linux-bpf/bpf-next/tools/testing/selftests/bpf/test_progs:0x13efd9: -EINVAL
libbpf: prog 'handle_uprobe': failed to create uprobe '/root/linux-bpf/bpf-next/tools/testing/selftests/bpf/test_progs:0x13efd9' perf event: -EINVAL
test_attach_uprobe_long_event_name:FAIL:attach_uprobe_long_event_name unexpected error: -22
#13/10 attach_probe/uprobe-long_name:FAIL
#13 attach_probe:FAIL
After Fix:
./test_progs -t attach_probe/uprobe-long_name
#13/10 attach_probe/uprobe-long_name:OK
#13 attach_probe:OK
Summary: 1/1 PASSED, 0 SKIPPED, 0 FAILED
./test_progs -t attach_probe/kprobe-long_name
#13/11 attach_probe/kprobe-long_name:OK
#13 attach_probe:OK
Summary: 1/1 PASSED, 0 SKIPPED, 0 FAILED
Fixes: 46ed5fc ("libbpf: Refactor and simplify legacy kprobe code")
Fixes: cc10623 ("libbpf: Add legacy uprobe attaching support")
Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Signed-off-by: Feng Yang <yangfeng@kylinos.cn>1 parent d70eedf commit 644844e
1 file changed
+12
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| |||
11142 | 11144 | | |
11143 | 11145 | | |
11144 | 11146 | | |
11145 | | - | |
11146 | | - | |
| 11147 | + | |
| 11148 | + | |
11147 | 11149 | | |
11148 | | - | |
| 11150 | + | |
11149 | 11151 | | |
11150 | 11152 | | |
11151 | 11153 | | |
| |||
11270 | 11272 | | |
11271 | 11273 | | |
11272 | 11274 | | |
11273 | | - | |
| 11275 | + | |
11274 | 11276 | | |
11275 | 11277 | | |
11276 | 11278 | | |
| |||
11328 | 11330 | | |
11329 | 11331 | | |
11330 | 11332 | | |
11331 | | - | |
| 11333 | + | |
11332 | 11334 | | |
11333 | 11335 | | |
11334 | 11336 | | |
| |||
11878 | 11880 | | |
11879 | 11881 | | |
11880 | 11882 | | |
| 11883 | + | |
11881 | 11884 | | |
11882 | 11885 | | |
11883 | | - | |
| 11886 | + | |
| 11887 | + | |
| 11888 | + | |
11884 | 11889 | | |
11885 | 11890 | | |
11886 | 11891 | | |
| |||
12312 | 12317 | | |
12313 | 12318 | | |
12314 | 12319 | | |
12315 | | - | |
| 12320 | + | |
12316 | 12321 | | |
12317 | 12322 | | |
12318 | 12323 | | |
| |||
0 commit comments