Skip to content

Commit aeb8fe0

Browse files
olsajiriAlexei Starovoitov
authored andcommitted
bpf: Fix bpf_session_cookie BTF_ID in special_kfunc_set list
The bpf_session_cookie is unavailable for !CONFIG_FPROBE as reported by Sebastian [1]. To fix that we remove CONFIG_FPROBE ifdef for session kfuncs, which is fine, because there's filter for session programs. Then based on bpf_trace.o dependency: obj-$(CONFIG_BPF_EVENTS) += bpf_trace.o we add bpf_session_cookie BTF_ID in special_kfunc_set list dependency on CONFIG_BPF_EVENTS. [1] https://lore.kernel.org/bpf/20240531071557.MvfIqkn7@linutronix.de/T/#m71c6d5ec71db2967288cb79acedc15cc5dbfeec5 Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Tested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Suggested-by: Alexei Starovoitov <ast@kernel.org> Fixes: 5c919ac ("bpf: Add support for kprobe session cookie") Signed-off-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/r/20240531194500.2967187-1-jolsa@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 62da3ac commit aeb8fe0

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

kernel/bpf/verifier.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11128,7 +11128,11 @@ BTF_ID(func, bpf_iter_css_task_new)
1112811128
#else
1112911129
BTF_ID_UNUSED
1113011130
#endif
11131+
#ifdef CONFIG_BPF_EVENTS
1113111132
BTF_ID(func, bpf_session_cookie)
11133+
#else
11134+
BTF_ID_UNUSED
11135+
#endif
1113211136

1113311137
static bool is_kfunc_ret_null(struct bpf_kfunc_call_arg_meta *meta)
1113411138
{

kernel/trace/bpf_trace.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3517,7 +3517,6 @@ static u64 bpf_uprobe_multi_entry_ip(struct bpf_run_ctx *ctx)
35173517
}
35183518
#endif /* CONFIG_UPROBES */
35193519

3520-
#ifdef CONFIG_FPROBE
35213520
__bpf_kfunc_start_defs();
35223521

35233522
__bpf_kfunc bool bpf_session_is_return(void)
@@ -3566,4 +3565,3 @@ static int __init bpf_kprobe_multi_kfuncs_init(void)
35663565
}
35673566

35683567
late_initcall(bpf_kprobe_multi_kfuncs_init);
3569-
#endif

0 commit comments

Comments
 (0)