[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5933395.DvuYhMxLoT@7950hx>
Date: Wed, 22 Oct 2025 22:11:23 +0800
From: Menglong Dong <menglong.dong@...ux.dev>
To: ast@...nel.org, jolsa@...nel.org, Menglong Dong <menglong8.dong@...il.com>
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, mathieu.desnoyers@...icios.com, leon.hwang@...ux.dev,
jiang.biao@...ux.dev, bpf@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Subject:
Re: [PATCH bpf-next v2 07/10] selftests/bpf: test get_func_ip for fsession
On 2025/10/22 16:01, Menglong Dong wrote:
> As the layout of the stack changed for fsession, we'd better test
> bpf_get_func_ip() for it.
>
> Signed-off-by: Menglong Dong <dongml2@...natelecom.cn>
> ---
> .../selftests/bpf/prog_tests/get_func_ip_test.c | 2 ++
> .../testing/selftests/bpf/progs/get_func_ip_test.c | 14 ++++++++++++++
> 2 files changed, 16 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/get_func_ip_test.c b/tools/testing/selftests/bpf/prog_tests/get_func_ip_test.c
> index c40242dfa8fb..a9078a1dbb07 100644
> --- a/tools/testing/selftests/bpf/prog_tests/get_func_ip_test.c
> +++ b/tools/testing/selftests/bpf/prog_tests/get_func_ip_test.c
> @@ -46,6 +46,8 @@ static void test_function_entry(void)
> ASSERT_EQ(skel->bss->test5_result, 1, "test5_result");
> ASSERT_EQ(skel->bss->test7_result, 1, "test7_result");
> ASSERT_EQ(skel->bss->test8_result, 1, "test8_result");
> + ASSERT_EQ(skel->bss->test9_result1, 1, "test9_result1");
> + ASSERT_EQ(skel->bss->test9_result2, 1, "test9_result2");
Oops, the fsession part should be factor out, and be skipped
if not X86_64, which failed the CI for !X86_64 arch :(
I'll fix it in the next version.
>
> cleanup:
> get_func_ip_test__destroy(skel);
> diff --git a/tools/testing/selftests/bpf/progs/get_func_ip_test.c b/tools/testing/selftests/bpf/progs/get_func_ip_test.c
> index 2011cacdeb18..9acb79fc7537 100644
> --- a/tools/testing/selftests/bpf/progs/get_func_ip_test.c
> +++ b/tools/testing/selftests/bpf/progs/get_func_ip_test.c
> @@ -103,3 +103,17 @@ int BPF_URETPROBE(test8, int ret)
> test8_result = (const void *) addr == (const void *) uprobe_trigger;
> return 0;
> }
> +
> +__u64 test9_result1 = 0;
> +__u64 test9_result2 = 0;
> +SEC("fsession/bpf_fentry_test1")
> +int BPF_PROG(test9, int a)
> +{
> + __u64 addr = bpf_get_func_ip(ctx);
> +
> + if (bpf_tracing_is_exit(ctx))
> + test9_result1 = (const void *) addr == &bpf_fentry_test1;
> + else
> + test9_result2 = (const void *) addr == &bpf_fentry_test1;
> + return 0;
> +}
>
Powered by blists - more mailing lists