[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251026030143.23807-8-dongml2@chinatelecom.cn>
Date: Sun, 26 Oct 2025 11:01:43 +0800
From: Menglong Dong <menglong8.dong@...il.com>
To: ast@...nel.org,
jolsa@...nel.org
Cc: daniel@...earbox.net,
john.fastabend@...il.com,
andrii@...nel.org,
martin.lau@...ux.dev,
eddyz87@...il.com,
song@...nel.org,
yonghong.song@...ux.dev,
kpsingh@...nel.org,
sdf@...ichev.me,
haoluo@...gle.com,
mattbobrowski@...gle.com,
rostedt@...dmis.org,
mhiramat@...nel.org,
leon.hwang@...ux.dev,
jiang.biao@...ux.dev,
bpf@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Subject: [PATCH bpf-next v3 7/7] selftests/bpf: test fsession mixed with fentry and fexit
Test the fsession when it is used together with fentry, fexit.
Signed-off-by: Menglong Dong <dongml2@...natelecom.cn>
---
.../selftests/bpf/progs/fsession_test.c | 34 +++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/tools/testing/selftests/bpf/progs/fsession_test.c b/tools/testing/selftests/bpf/progs/fsession_test.c
index 8f266d8e4b55..f78348e541a4 100644
--- a/tools/testing/selftests/bpf/progs/fsession_test.c
+++ b/tools/testing/selftests/bpf/progs/fsession_test.c
@@ -228,3 +228,37 @@ int BPF_PROG(test12, int a)
test12_exit_ok = *cookie == 0x1111222233334444ull;
return 0;
}
+
+__u64 test13_entry_result = 0;
+__u64 test13_exit_result = 0;
+
+SEC("fsession/bpf_fentry_test1")
+int BPF_PROG(test13, int a, int ret)
+{
+ __u64 *cookie = bpf_fsession_cookie(ctx);
+
+ if (!bpf_tracing_is_exit(ctx)) {
+ test13_entry_result = a == 1 && ret == 0;
+ *cookie = 0x123456ULL;
+ return 0;
+ }
+
+ test13_exit_result = a == 1 && ret == 2 && *cookie == 0x123456ULL;
+ return 0;
+}
+
+__u64 test14_result = 0;
+SEC("fexit/bpf_fentry_test1")
+int BPF_PROG(test14, int a, int ret)
+{
+ test14_result = a == 1 && ret == 2;
+ return 0;
+}
+
+__u64 test15_result = 0;
+SEC("fentry/bpf_fentry_test1")
+int BPF_PROG(test15, int a)
+{
+ test15_result = a == 1;
+ return 0;
+}
--
2.51.1
Powered by blists - more mailing lists