Skip to content

Commit b836e48

Browse files
committed
test
1 parent 8fdadac commit b836e48

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

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

+17-6
Original file line numberDiff line numberDiff line change
@@ -623,19 +623,29 @@ static void *worker_trigger(void *arg)
623623
static void *worker_attach(void *arg)
624624
{
625625
struct uprobe_syscall_executed *skel;
626-
unsigned long rounds = 0;
626+
unsigned long rounds = 0, offset;
627+
void *addr;
628+
629+
addr = find_nop5(&uprobe_test);
630+
if (!ASSERT_OK_PTR(addr, "find_nop5"))
631+
return NULL;
632+
633+
offset = get_uprobe_offset(addr);
634+
if (!ASSERT_GE(offset, 0, "get_uprobe_offset"))
635+
return NULL;
627636

628637
skel = uprobe_syscall_executed__open_and_load();
629638
if (!ASSERT_OK_PTR(skel, "uprobe_syscall_executed__open_and_load"))
630639
return NULL;
631640

632641
while (!race_stop) {
633-
skel->links.test_uprobe_multi = bpf_program__attach_uprobe_multi(skel->progs.test_uprobe_multi,
634-
-1, "/proc/self/exe", "uprobe_test", NULL);
635-
if (!ASSERT_OK_PTR(skel->links.test_uprobe_multi, "bpf_program__attach_uprobe_multi"))
642+
skel->links.test_uprobe = bpf_program__attach_uprobe_opts(skel->progs.test_uprobe,
643+
0, "/proc/self/exe", offset, NULL);
644+
if (!ASSERT_OK_PTR(skel->links.test_uprobe, "bpf_program__attach_uprobe_opts"))
636645
break;
637-
bpf_link__destroy(skel->links.test_uprobe_multi);
638-
skel->links.test_uprobe_multi = NULL;
646+
647+
bpf_link__destroy(skel->links.test_uprobe);
648+
skel->links.test_uprobe = NULL;
639649
rounds++;
640650
}
641651

@@ -653,6 +663,7 @@ static void test_uprobe_race(void)
653663
if (!ASSERT_GE(nr_cpus, 0, "nr_cpus"))
654664
return;
655665

666+
nr_cpus /= 2;
656667
nr = nr_cpus * 2;
657668
threads = malloc(sizeof(*threads) * nr);
658669
if (!ASSERT_OK_PTR(threads, "malloc"))

0 commit comments

Comments
 (0)