bpf: Use an UNUSED id for bpf_session_cookie without FPROBE
Subsystems (5)
PATCH 1/1 bpf: Use an UNUSED id for bpf_session_cookie without FPROBE
bpf_session_cookie() is only available with CONFIG_FPROBE=y leading to an unresolved symbol otherwise.
Use BTF_ID_UNUSED instead of bpf_session_cookie for CONFIG_FPROBE=n.
--- kernel/bpf/verifier.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/bpf/verifier.c +4 -0
@@ -11124,7 +11124,11 @@ BTF_ID(func, bpf_iter_css_task_new)#else BTF_ID_UNUSED#endif +#ifdef CONFIG_FPROBE BTF_ID(func, bpf_session_cookie) +#else +BTF_ID_UNUSED +#endif static bool is_kfunc_ret_null (struct bpf_kfunc_call_arg_meta *meta) {
Signature · 1 line
2.45.1
Quoted 17 lines · Sebastian Andrzej Siewior
bpf_session_cookie()is only available withCONFIG_FPROBE=yleading to an unresolved symbol otherwise.Use
BTF_ID_UNUSEDinstead ofbpf_session_cookieforCONFIG_FPROBE=n.Fixes 5c919acef8514 ("bpf: Add support for kprobe session cookie")Signed-off-by Sebastian Andrzej Siewior <[email protected]>--- kernel/bpf/verifier.c | 4 ++++ 1 file changed, 4 insertions(+)kernel/bpf/verifier.c +0
-0
kernel/bpf/verifier.c BTF_ID(func, bpf_iter_css_task_new) · line 11131
Quoted 8 lines
kernel/bpf/verifier.c +4
-0@@ -11124,7 +11124,11 @@ BTF_ID(func, bpf_iter_css_task_new)#else BTF_ID_UNUSED#endif +#ifdef CONFIG_FPROBE BTF_ID(func, bpf_session_cookie) +#else +BTF_ID_UNUSED +#endif
Instead of this fix..
Jiri,
maybe remove ifdef CONFIG_FPROBE hiding of this kfunc in kernel/tace/bpf_trace.c ?
The less ifdef-s the better. imo
Quoted 25 lines · Alexei Starovoitov
Quoted 23 lines · Sebastian Andrzej Siewior
bpf_session_cookie()is only available withCONFIG_FPROBE=yleading to an unresolved symbol otherwise.Use
BTF_ID_UNUSEDinstead ofbpf_session_cookieforCONFIG_FPROBE=n.Fixes 5c919acef8514 ("bpf: Add support for kprobe session cookie")Signed-off-by Sebastian Andrzej Siewior <[email protected]>--- kernel/bpf/verifier.c | 4 ++++ 1 file changed, 4 insertions(+)kernel/bpf/verifier.c +2
-0@@ -11124,7 +11124,11 @@ BTF_ID(func, bpf_iter_css_task_new)#else BTF_ID_UNUSED#endif +#ifdef CONFIG_FPROBE BTF_ID (func, bpf_session_cookie) +#else
Quoted 8 lines
kernel/bpf/verifier.c BTF_ID(func, bpf_iter_css_task_new) · line 11131
Quoted 2 lines
kernel/bpf/verifier.c +2
-0+BTF_ID_UNUSED +#endif Instead of this fix..
Jiri,
maybe remove ifdefCONFIG_FPROBEhiding of this kfunc inkernel/tace/bpf_trace.c?
The less ifdef-s the better. imo
yes, that seems to work
Sebastian, do you want to send it as v2 or should I post it?
thanks,
jirka
---
kernel/trace/bpf_trace.c +0 -2
@@ -3519,7 +3519,6 @@ static u64 bpf_uprobe_multi_entry_ip(struct bpf_run_ctx *ctx) }#endif /* CONFIG_UPROBES */ -#ifdef CONFIG_FPROBE __bpf_kfunc_start_defs (); __bpf_kfunc bool bpf_session_is_return(void)
@@ -3568,4 +3567,3 @@ static int __init bpf_kprobe_multi_kfuncs_init(void) }late_initcall (bpf_kprobe_multi_kfuncs_init); -#endif
Quoted 12 lines · Jiri Olsa
Quoted 11 lines
Review
Quoted 5 lines
(quoted diff) +4
-0+#ifdef CONFIG_FPROBE BTF_ID(func, bpf_session_cookie) +#else +BTF_ID_UNUSED +#endifInstead of this fix..
Jiri,
maybe remove ifdefCONFIG_FPROBEhiding of this kfunc inkernel/tace/bpf_trace.c?
The less ifdef-s the better. imo
Quoted 3 lines
yes, that seems to work
Sebastian, do you want to send it as v2 or should I post it?
Now that I look again, ifdef CONFIG_FPROBE isn't enough it requires additionally CONFIG_UPROBE_EVENTS.
So the suggested snippet does not work if CONFIG_UPROBE_EVENTS is not enabled.
Quoted 2 lines
thanks,
jirka
Sebastian