[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240604200221.377848-9-jolsa@kernel.org>
Date: Tue, 4 Jun 2024 22:02:19 +0200
From: Jiri Olsa <jolsa@...nel.org>
To: Oleg Nesterov <oleg@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>
Cc: bpf@...r.kernel.org,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>,
Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Subject: [RFC bpf-next 08/10] selftests/bpf: Add uprobe session errors test
Adding uprobe session test to check that just single
session instance is allowed or single uprobe.
Signed-off-by: Jiri Olsa <jolsa@...nel.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
Powered by blists - more mailing lists