Commit 3983c00
bpf: Fail uprobe multi link with negative offset
Currently the __uprobe_register will return 0 (success) when called with
negative offset. The reason is that the call to register_for_each_vma and
then build_map_info won't return error for negative offset. They just won't
do anything - no matching vma is found so there's no registered breakpoint
for the uprobe.
I don't think we can change the behaviour of __uprobe_register and fail
for negative uprobe offset, because apps might depend on that already.
But I think we can still make the change and check for it on bpf multi
link syscall level.
Also moving the __get_user call and check for the offsets to the top of
loop, to fail early without extra __get_user calls for ref_ctr_offset
and cookie arrays.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/bpf/20231217215538.3361991-2-jolsa@kernel.org1 parent e58aac1 commit 3983c00
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3391 | 3391 | | |
3392 | 3392 | | |
3393 | 3393 | | |
3394 | | - | |
| 3394 | + | |
3395 | 3395 | | |
3396 | 3396 | | |
3397 | 3397 | | |
| 3398 | + | |
| 3399 | + | |
| 3400 | + | |
| 3401 | + | |
3398 | 3402 | | |
3399 | 3403 | | |
3400 | 3404 | | |
3401 | 3405 | | |
3402 | | - | |
| 3406 | + | |
3403 | 3407 | | |
3404 | 3408 | | |
3405 | 3409 | | |
| |||
0 commit comments