Commit 9e7240fb authored by Yucong Sun's avatar Yucong Sun Committed by Andrii Nakryiko

selftests/bpf: Fix attach_probe in parallel mode

This patch makes attach_probe uses its own method as attach point,
avoiding conflict with other tests like bpf_cookie.
Signed-off-by: default avatarYucong Sun <sunyucong@gmail.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211025223345.2136168-4-fallentree@fb.com
parent 547208a3
...@@ -5,6 +5,11 @@ ...@@ -5,6 +5,11 @@
/* this is how USDT semaphore is actually defined, except volatile modifier */ /* this is how USDT semaphore is actually defined, except volatile modifier */
volatile unsigned short uprobe_ref_ctr __attribute__((unused)) __attribute((section(".probes"))); volatile unsigned short uprobe_ref_ctr __attribute__((unused)) __attribute((section(".probes")));
/* attach point */
static void method(void) {
return ;
}
void test_attach_probe(void) void test_attach_probe(void)
{ {
DECLARE_LIBBPF_OPTS(bpf_uprobe_opts, uprobe_opts); DECLARE_LIBBPF_OPTS(bpf_uprobe_opts, uprobe_opts);
...@@ -33,7 +38,7 @@ void test_attach_probe(void) ...@@ -33,7 +38,7 @@ void test_attach_probe(void)
if (CHECK(base_addr < 0, "get_base_addr", if (CHECK(base_addr < 0, "get_base_addr",
"failed to find base addr: %zd", base_addr)) "failed to find base addr: %zd", base_addr))
return; return;
uprobe_offset = get_uprobe_offset(&get_base_addr, base_addr); uprobe_offset = get_uprobe_offset(&method, base_addr);
ref_ctr_offset = get_rel_offset((uintptr_t)&uprobe_ref_ctr); ref_ctr_offset = get_rel_offset((uintptr_t)&uprobe_ref_ctr);
if (!ASSERT_GE(ref_ctr_offset, 0, "ref_ctr_offset")) if (!ASSERT_GE(ref_ctr_offset, 0, "ref_ctr_offset"))
...@@ -98,7 +103,7 @@ void test_attach_probe(void) ...@@ -98,7 +103,7 @@ void test_attach_probe(void)
goto cleanup; goto cleanup;
/* trigger & validate uprobe & uretprobe */ /* trigger & validate uprobe & uretprobe */
get_base_addr(); method();
if (CHECK(skel->bss->uprobe_res != 3, "check_uprobe_res", if (CHECK(skel->bss->uprobe_res != 3, "check_uprobe_res",
"wrong uprobe res: %d\n", skel->bss->uprobe_res)) "wrong uprobe res: %d\n", skel->bss->uprobe_res))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment