Thread (30 messages) 30 messages, 4 authors, 2025-12-20

Re: [PATCH bpf-next v4 8/9] selftests/bpf: add testcases for tracing session

From: Menglong Dong <hidden>
Date: 2025-12-17 11:42:23
Also in: bpf, lkml

On 2025/12/17 18:24 bot+bpf-ci@kernel.org write:
quoted
diff --git a/tools/testing/selftests/bpf/progs/fsession_test.c b/tools/testing/selftests/bpf/progs/fsession_test.c
new file mode 100644
index 000000000000..f7c96ef1c7a9
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/fsession_test.c
@@ -0,0 +1,192 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2025 ChinaTelecom */
+#include <vmlinux.h>
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
+
+char _license[] SEC("license") = "GPL";
[ ... ]
quoted
+__u64 test8_entry_result = 0;
+__u64 test8_exit_result = 0;
+SEC("fsession/bpf_fentry_test1")
+int BPF_PROG(test8, int a)
+{
+	__u64 addr = bpf_get_func_ip(ctx);
+
+	if (bpf_fsession_is_return(ctx))
+		test8_exit_result = (const void *) addr == &bpf_fentry_test1;
+	else
+		test8_entry_result = (const void *) addr == &bpf_fentry_test1;
+	return 0;
+}
In test8, the code uses &bpf_fentry_test1 without declaring it. Looking at
similar tests like kprobe_multi.c and kprobe_multi_session.c, they include:

    extern const void bpf_fentry_test1 __ksym;

at the top of the file before taking the address of kernel symbols.
Without the __ksym declaration, does the comparison work correctly, or
would this cause the test to fail during compilation or at runtime?
It seems that it is generated into vmlinux.h, and that's why it works
well during compilation and runtime.

Thanks!
Menglong Dong

---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/20299185010


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help