From: Menglong Dong <menglong8.dong@gmail.com>
To: ast@kernel.org, jolsa@kernel.org
Cc: daniel@iogearbox.net, john.fastabend@gmail.com,
andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com,
song@kernel.org, yonghong.song@linux.dev, kpsingh@kernel.org,
sdf@fomichev.me, haoluo@google.com, mattbobrowski@google.com,
rostedt@goodmis.org, mhiramat@kernel.org, leon.hwang@linux.dev,
jiang.biao@linux.dev, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: [PATCH bpf-next v3 7/7] selftests/bpf: test fsession mixed with fentry and fexit
Date: Sun, 26 Oct 2025 11:01:43 +0800 [thread overview]
Message-ID: <20251026030143.23807-8-dongml2@chinatelecom.cn> (raw)
In-Reply-To: <20251026030143.23807-1-dongml2@chinatelecom.cn>
Test the fsession when it is used together with fentry, fexit.
Signed-off-by: Menglong Dong <dongml2@chinatelecom.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
prev parent reply other threads:[~2025-10-26 3:02 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-26 3:01 [PATCH bpf-next v3 0/7] bpf: tracing session supporting Menglong Dong
2025-10-26 3:01 ` [PATCH bpf-next v3 1/7] bpf: add tracing session support Menglong Dong
2025-10-26 3:01 ` [PATCH bpf-next v3 2/7] bpf: add two kfunc for TRACE_SESSION Menglong Dong
2025-10-26 4:42 ` kernel test robot
2025-10-27 2:44 ` kernel test robot
2025-10-29 2:54 ` Menglong Dong
2025-11-05 0:40 ` Andrii Nakryiko
2025-10-26 3:01 ` [PATCH bpf-next v3 3/7] bpf,x86: add ret_off to invoke_bpf() Menglong Dong
2025-10-26 3:01 ` [PATCH bpf-next v3 4/7] bpf,x86: add tracing session supporting for x86_64 Menglong Dong
2025-10-31 1:42 ` Alexei Starovoitov
2025-10-31 3:36 ` Menglong Dong
2025-10-31 17:57 ` Alexei Starovoitov
2025-11-03 6:00 ` Leon Hwang
2025-11-03 11:24 ` Menglong Dong
2025-11-05 0:40 ` Andrii Nakryiko
2025-11-05 2:43 ` Alexei Starovoitov
2025-11-05 3:48 ` Menglong Dong
2025-11-05 17:29 ` Andrii Nakryiko
2025-11-05 22:00 ` Alexei Starovoitov
2025-11-06 12:14 ` Menglong Dong
2025-11-06 17:03 ` Andrii Nakryiko
2025-10-26 3:01 ` [PATCH bpf-next v3 5/7] libbpf: add support for tracing session Menglong Dong
2025-10-26 3:01 ` [PATCH bpf-next v3 6/7] selftests/bpf: add testcases " Menglong Dong
2025-10-26 3:01 ` Menglong Dong [this message]
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=20251026030143.23807-8-dongml2@chinatelecom.cn \
--to=menglong8.dong@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=jiang.biao@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=leon.hwang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mattbobrowski@google.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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
all inboxes | Powered by JetHome®