Skip to content

Commit b836cbd

Browse files
ver-nyananakryiko
authored andcommitted
selftests/bpf: Assert link info uprobe_multi count & path_size if unset
Add assertions in `bpf_link_info.uprobe_multi` test to verify that `count` and `path_size` fields are correctly populated when the fields are unset. This tests a previous bug where the `path_size` field was not populated when `path` and `path_size` were unset. Signed-off-by: Tyrone Wu <wudevelops@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20241011000803.681190-2-wudevelops@gmail.com
1 parent ad6b5b6 commit b836cbd

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tools/testing/selftests/bpf/prog_tests/fill_link_info.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,15 @@ verify_umulti_link_info(int fd, bool retprobe, __u64 *offsets,
420420
if (!ASSERT_NEQ(err, -1, "readlink"))
421421
return -1;
422422

423+
memset(&info, 0, sizeof(info));
424+
err = bpf_link_get_info_by_fd(fd, &info, &len);
425+
if (!ASSERT_OK(err, "bpf_link_get_info_by_fd"))
426+
return -1;
427+
428+
ASSERT_EQ(info.uprobe_multi.count, 3, "info.uprobe_multi.count");
429+
ASSERT_EQ(info.uprobe_multi.path_size, strlen(path) + 1,
430+
"info.uprobe_multi.path_size");
431+
423432
for (bit = 0; bit < 8; bit++) {
424433
memset(&info, 0, sizeof(info));
425434
info.uprobe_multi.path = ptr_to_u64(path_buf);

0 commit comments

Comments
 (0)