From: Jiri Olsa <jolsa@kernel.org>
To: Oleg Nesterov <oleg@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, Martin KaFai Lau <kafai@fb.com>,
Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: [RFC bpf-next 08/10] selftests/bpf: Add uprobe session errors test
Date: Tue, 4 Jun 2024 22:02:19 +0200 [thread overview]
Message-ID: <20240604200221.377848-9-jolsa@kernel.org> (raw)
In-Reply-To: <20240604200221.377848-1-jolsa@kernel.org>
Adding uprobe session test to check that just single
session instance is allowed or single uprobe.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
.../bpf/prog_tests/uprobe_multi_test.c | 27 +++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c b/tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c
index fddca2597818..4bff681f0d7d 100644
--- a/tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c
+++ b/tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c
@@ -533,6 +533,31 @@ static void test_session_skel_api(void)
uprobe_multi_session__destroy(skel);
}
+static void test_session_error_multiple_instances(void)
+{
+ struct uprobe_multi_session *skel_1 = NULL, *skel_2 = NULL;
+ int err;
+
+ skel_1 = uprobe_multi_session__open_and_load();
+ if (!ASSERT_OK_PTR(skel_1, "fentry_raw_skel_load"))
+ goto cleanup;
+
+ err = uprobe_multi_session__attach(skel_1);
+ if (!ASSERT_OK(err, " kprobe_multi_session__attach"))
+ goto cleanup;
+
+ skel_2 = uprobe_multi_session__open_and_load();
+ if (!ASSERT_OK_PTR(skel_2, "fentry_raw_skel_load"))
+ goto cleanup;
+
+ err = uprobe_multi_session__attach(skel_2);
+ ASSERT_EQ(err, -EBUSY, " kprobe_multi_session__attach");
+
+cleanup:
+ uprobe_multi_session__destroy(skel_1);
+ uprobe_multi_session__destroy(skel_2);
+}
+
static void test_bench_attach_uprobe(void)
{
long attach_start_ns = 0, attach_end_ns = 0;
@@ -623,4 +648,6 @@ void test_uprobe_multi_test(void)
test_attach_api_fails();
if (test__start_subtest("session"))
test_session_skel_api();
+ if (test__start_subtest("session_errors"))
+ test_session_error_multiple_instances();
}
--
2.45.1
next prev parent reply other threads:[~2024-06-04 20:04 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 20:02 [RFC bpf-next 00/10] uprobe, bpf: Add session support Jiri Olsa
2024-06-04 20:02 ` [RFC bpf-next 01/10] uprobe: Add session callbacks to uprobe_consumer Jiri Olsa
2024-06-05 15:24 ` Oleg Nesterov
2024-06-05 16:01 ` Oleg Nesterov
2024-06-05 16:36 ` Oleg Nesterov
2024-06-05 20:18 ` Jiri Olsa
2024-06-05 17:25 ` Andrii Nakryiko
2024-06-05 17:56 ` Oleg Nesterov
2024-06-05 20:47 ` Andrii Nakryiko
2024-06-05 21:17 ` Jiri Olsa
2024-06-05 21:23 ` Oleg Nesterov
2024-06-05 20:50 ` Jiri Olsa
2024-06-05 21:00 ` Oleg Nesterov
2024-06-06 16:46 ` Jiri Olsa
2024-06-06 16:52 ` Andrii Nakryiko
2024-06-10 11:06 ` Jiri Olsa
2024-06-17 22:53 ` Andrii Nakryiko
2024-06-19 18:48 ` Jiri Olsa
2024-06-05 21:01 ` Jiri Olsa
2024-06-04 20:02 ` [RFC bpf-next 02/10] bpf: Add support for uprobe multi session attach Jiri Olsa
2024-06-04 20:02 ` [RFC bpf-next 03/10] bpf: Add support for uprobe multi session context Jiri Olsa
2024-06-04 20:02 ` [RFC bpf-next 04/10] libbpf: Add support for uprobe multi session attach Jiri Olsa
2024-06-04 20:02 ` [RFC bpf-next 05/10] libbpf: Add uprobe session attach type names to attach_type_name Jiri Olsa
2024-06-04 20:02 ` [RFC bpf-next 06/10] selftests/bpf: Move ARRAY_SIZE to bpf_misc.h Jiri Olsa
2024-06-04 20:02 ` [RFC bpf-next 07/10] selftests/bpf: Add uprobe session test Jiri Olsa
2024-06-04 20:02 ` Jiri Olsa [this message]
2024-06-04 20:02 ` [RFC bpf-next 09/10] selftests/bpf: Add uprobe session cookie test Jiri Olsa
2024-06-04 20:02 ` [RFC bpf-next 10/10] selftests/bpf: Add uprobe session recursive test Jiri Olsa
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=20240604200221.377848-9-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sdf@google.com \
--cc=songliubraving@fb.com \
--cc=yhs@fb.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;
as well as URLs for NNTP newsgroup(s).