Re: [PATCH bpf-next v1 5/6] bpf: mark bpf_stream_vprink kfunc with KF_IMPLICIT_PROG_AUX_ARG

Andrii Nakryiko
2025-09-25T17:28:42Z

On Thu, Sep 25, 2025 at 3:01 AM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Wed, Sep 24, 2025 at 10:17 PM Ihor Solodrai <ihor.solodrai@linux.dev> wrote:
> >
> > Update bpf_stream_vprink macro in libbpf and fix call sites in
>
> 't' is missing in bpf_stream_vprintk().
>
> > the relevant selftests.
> >
> > Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
> > ---
> > kernel/bpf/helpers.c | 2 +-
> > kernel/bpf/stream.c | 3 +--
> > tools/lib/bpf/bpf_helpers.h | 4 ++--
> > tools/testing/selftests/bpf/progs/stream_fail.c | 6 +++---
> > 4 files changed, 7 insertions(+), 8 deletions(-)
> >
> > diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> > index 6b46acfec790..875195a0ea72 100644
> > --- a/kernel/bpf/helpers.c
> > +++ b/kernel/bpf/helpers.c
> > @@ -4378,7 +4378,7 @@ BTF_ID_FLAGS(func, bpf_strnstr);
> > #if defined(CONFIG_BPF_LSM) && defined(CONFIG_CGROUPS)
> > BTF_ID_FLAGS(func, bpf_cgroup_read_xattr, KF_RCU)
> > #endif
> > -BTF_ID_FLAGS(func, bpf_stream_vprintk, KF_TRUSTED_ARGS)
> > +BTF_ID_FLAGS(func, bpf_stream_vprintk, KF_TRUSTED_ARGS | KF_IMPLICIT_PROG_AUX_ARG)
>
> This kfunc will be in part of 6.17 release in a couple days,
> so backward compat work is necessary.
> I don't think we can just remove the arg.

Can we still rename current "explicit prog_aux" version to
bpf_stream_vprintk_impl() still?

That would solve backwards compat problems and would be in line with
bpf_wq_set_callback_impl() approach.

If we can't, then we'd have to name the new function something different?

Don't know if there is some other BPF CO-RE and ELF symbol aliasing
magic that can be used, we'll need to play with this to see what
works.

>
> > --- a/tools/lib/bpf/bpf_helpers.h
> > +++ b/tools/lib/bpf/bpf_helpers.h
> > @@ -316,7 +316,7 @@ enum libbpf_tristate {
> > })
> >
> > extern int bpf_stream_vprintk(int stream_id, const char *fmt__str, const void *args,
> > - __u32 len__sz, void *aux__prog) __weak __ksym;
> > + __u32 len__sz) __weak __ksym;
>
> CI is complaining of conflicting types for 'bpf_stream_vprintk',
> since it's using pahole master.
> It will stop complaining once pahole changes are merged,
> but this issue will affect all developers until they
> update pahole.
> Not sure how to keep backward compat.