Re: [PATCH bpf-next v9 03/11] bpf: change prototype of bpf_session_{cookie,is_return}

From: Andrii Nakryiko

Date: Tue Jan 13 2026 - 20:23:44 EST


On Sat, Jan 10, 2026 at 6:12 AM Menglong Dong <menglong8.dong@xxxxxxxxx> wrote:
>
> Add the function argument of "void *ctx" to bpf_session_cookie() and
> bpf_session_is_return(), which is a preparation of the next patch.
>
> The two kfunc is seldom used now, so it will not introduce much effect
> to change their function prototype.
>
> Signed-off-by: Menglong Dong <dongml2@xxxxxxxxxxxxxxx>
> ---
> kernel/trace/bpf_trace.c | 4 ++--
> tools/testing/selftests/bpf/bpf_kfuncs.h | 4 ++--
> .../bpf/progs/kprobe_multi_session_cookie.c | 12 ++++++------
> .../selftests/bpf/progs/uprobe_multi_session.c | 4 ++--
> .../bpf/progs/uprobe_multi_session_cookie.c | 12 ++++++------
> .../bpf/progs/uprobe_multi_session_recursive.c | 8 ++++----
> 6 files changed, 22 insertions(+), 22 deletions(-)
>

LGTM, let's do it

Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>

> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index 5f621f0403f8..297dcafb2c55 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -3316,7 +3316,7 @@ static u64 bpf_uprobe_multi_entry_ip(struct bpf_run_ctx *ctx)
>
> __bpf_kfunc_start_defs();
>
> -__bpf_kfunc bool bpf_session_is_return(void)
> +__bpf_kfunc bool bpf_session_is_return(void *ctx)
> {
> struct bpf_session_run_ctx *session_ctx;
>
> @@ -3324,7 +3324,7 @@ __bpf_kfunc bool bpf_session_is_return(void)
> return session_ctx->is_return;
> }
>
> -__bpf_kfunc __u64 *bpf_session_cookie(void)
> +__bpf_kfunc __u64 *bpf_session_cookie(void *ctx)
> {
> struct bpf_session_run_ctx *session_ctx;
>
> diff --git a/tools/testing/selftests/bpf/bpf_kfuncs.h b/tools/testing/selftests/bpf/bpf_kfuncs.h
> index e0189254bb6e..dc495cb4c22e 100644
> --- a/tools/testing/selftests/bpf/bpf_kfuncs.h
> +++ b/tools/testing/selftests/bpf/bpf_kfuncs.h
> @@ -79,8 +79,8 @@ extern int bpf_verify_pkcs7_signature(struct bpf_dynptr *data_ptr,
> struct bpf_dynptr *sig_ptr,
> struct bpf_key *trusted_keyring) __ksym;
>
> -extern bool bpf_session_is_return(void) __ksym __weak;
> -extern __u64 *bpf_session_cookie(void) __ksym __weak;
> +extern bool bpf_session_is_return(void *ctx) __ksym __weak;
> +extern __u64 *bpf_session_cookie(void *ctx) __ksym __weak;
>

(and actually drop these, vmlinux.h will have them)

> struct dentry;
> /* Description

[...]