* [PATCH] bpf: Use an UNUSED id for bpf_session_cookie without FPROBE
@ 2024-05-29 12:44 Sebastian Andrzej Siewior
2024-05-29 16:18 ` Alexei Starovoitov
0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2024-05-29 12:44 UTC (permalink / raw)
To: bpf
Cc: Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Viktor Malik,
Masami Hiramatsu (Google), Thomas Gleixner
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.
Fixes: 5c919acef8514 ("bpf: Add support for kprobe session cookie")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/bpf/verifier.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 77da1f438becc..436f72bfcb9b9 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -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)
{
--
2.45.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] bpf: Use an UNUSED id for bpf_session_cookie without FPROBE
2024-05-29 12:44 [PATCH] bpf: Use an UNUSED id for bpf_session_cookie without FPROBE Sebastian Andrzej Siewior
@ 2024-05-29 16:18 ` Alexei Starovoitov
2024-05-29 19:34 ` Jiri Olsa
0 siblings, 1 reply; 4+ messages in thread
From: Alexei Starovoitov @ 2024-05-29 16:18 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: bpf, Jiri Olsa, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo,
Viktor Malik, Masami Hiramatsu (Google), Thomas Gleixner
On Wed, May 29, 2024 at 5:44 AM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> 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.
>
> Fixes: 5c919acef8514 ("bpf: Add support for kprobe session cookie")
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> kernel/bpf/verifier.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 77da1f438becc..436f72bfcb9b9 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bpf: Use an UNUSED id for bpf_session_cookie without FPROBE
2024-05-29 16:18 ` Alexei Starovoitov
@ 2024-05-29 19:34 ` Jiri Olsa
2024-05-31 7:15 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 4+ messages in thread
From: Jiri Olsa @ 2024-05-29 19:34 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Sebastian Andrzej Siewior, bpf, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Viktor Malik, Masami Hiramatsu (Google), Thomas Gleixner
On Wed, May 29, 2024 at 09:18:48AM -0700, Alexei Starovoitov wrote:
> On Wed, May 29, 2024 at 5:44 AM Sebastian Andrzej Siewior
> <bigeasy@linutronix.de> wrote:
> >
> > 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.
> >
> > Fixes: 5c919acef8514 ("bpf: Add support for kprobe session cookie")
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > ---
> > kernel/bpf/verifier.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> > index 77da1f438becc..436f72bfcb9b9 100644
> > --- a/kernel/bpf/verifier.c
> > +++ b/kernel/bpf/verifier.c
> > @@ -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
yes, that seems to work
Sebastian, do you want to send it as v2 or should I post it?
thanks,
jirka
---
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index f5154c051d2c..cc90d56732eb 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] bpf: Use an UNUSED id for bpf_session_cookie without FPROBE
2024-05-29 19:34 ` Jiri Olsa
@ 2024-05-31 7:15 ` Sebastian Andrzej Siewior
0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2024-05-31 7:15 UTC (permalink / raw)
To: Jiri Olsa
Cc: Alexei Starovoitov, bpf, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo,
Viktor Malik, Masami Hiramatsu (Google), Thomas Gleixner
On 2024-05-29 21:34:25 [+0200], Jiri Olsa wrote:
> > > +#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
>
> 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.
> thanks,
> jirka
Sebastian
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-31 7:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-29 12:44 [PATCH] bpf: Use an UNUSED id for bpf_session_cookie without FPROBE Sebastian Andrzej Siewior
2024-05-29 16:18 ` Alexei Starovoitov
2024-05-29 19:34 ` Jiri Olsa
2024-05-31 7:15 ` Sebastian Andrzej Siewior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox