BPF List
 help / color / mirror / Atom feed
From: Yucong Sun <fallentree@fb.com>
To: <bpf@vger.kernel.org>
Cc: <andrii@kernel.org>, Yucong Sun <sunyucong@gmail.com>
Subject: [PATCH bpf-next 3/4] selftests/bpf: fix attach_probe in parallel mode
Date: Mon, 25 Oct 2021 15:33:44 -0700	[thread overview]
Message-ID: <20211025223345.2136168-4-fallentree@fb.com> (raw)
In-Reply-To: <20211025223345.2136168-1-fallentree@fb.com>

From: Yucong Sun <sunyucong@gmail.com>

This patch makes attach_probe uses its own method as attach point,
avoiding conflict with other tests like bpf_cookie.

Signed-off-by: Yucong Sun <sunyucong@gmail.com>
---
 tools/testing/selftests/bpf/prog_tests/attach_probe.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/attach_probe.c b/tools/testing/selftests/bpf/prog_tests/attach_probe.c
index 6c511dcd1465..d0bd51eb23c8 100644
--- a/tools/testing/selftests/bpf/prog_tests/attach_probe.c
+++ b/tools/testing/selftests/bpf/prog_tests/attach_probe.c
@@ -5,6 +5,11 @@
 /* this is how USDT semaphore is actually defined, except volatile modifier */
 volatile unsigned short uprobe_ref_ctr __attribute__((unused)) __attribute((section(".probes")));
 
+/* attach point */
+static void method(void) {
+	return ;
+}
+
 void test_attach_probe(void)
 {
 	DECLARE_LIBBPF_OPTS(bpf_uprobe_opts, uprobe_opts);
@@ -33,7 +38,7 @@ void test_attach_probe(void)
 	if (CHECK(base_addr < 0, "get_base_addr",
 		  "failed to find base addr: %zd", base_addr))
 		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);
 	if (!ASSERT_GE(ref_ctr_offset, 0, "ref_ctr_offset"))
@@ -98,7 +103,7 @@ void test_attach_probe(void)
 		goto cleanup;
 
 	/* trigger & validate uprobe & uretprobe */
-	get_base_addr();
+	method();
 
 	if (CHECK(skel->bss->uprobe_res != 3, "check_uprobe_res",
 		  "wrong uprobe res: %d\n", skel->bss->uprobe_res))
-- 
2.30.2


  parent reply	other threads:[~2021-10-25 22:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 22:33 [PATCH bpf-next 0/4] selftests/bpf: parallel mode improvement Yucong Sun
2021-10-25 22:33 ` [PATCH bpf-next 1/4] selfetests/bpf: Update vmtest.sh defaults Yucong Sun
2021-10-25 22:33 ` [PATCH bpf-next 2/4] selftests/bpf: print subtest status line Yucong Sun
2021-10-26  4:09   ` Andrii Nakryiko
2021-10-26 17:24     ` sunyucong
2021-10-27 16:46       ` Andrii Nakryiko
2021-10-25 22:33 ` Yucong Sun [this message]
2021-10-26  4:11   ` [PATCH bpf-next 3/4] selftests/bpf: fix attach_probe in parallel mode Andrii Nakryiko
2021-10-25 22:33 ` [PATCH bpf-next 4/4] selftests/bpf: adding a namespace reset for tc_redirect Yucong Sun
2021-10-27 19:18 ` [PATCH bpf-next 0/4] selftests/bpf: parallel mode improvement Andrii Nakryiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211025223345.2136168-4-fallentree@fb.com \
    --to=fallentree@fb.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sunyucong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox