On Thu, Apr 09, 2026 at 07:28:55PM +0800, Menglong Dong wrote:
> On 2026/4/8 21:21 Jiri Olsa <[email protected]> write:
> > On Wed, Apr 08, 2026 at 02:21:07PM +0800, Menglong Dong wrote:
> > > The fsession attach type is missed in the verifier log in
> > > check_get_func_ip(), bpf_check_attach_target() and check_attach_btf_id().
> > > Update them to make the verifier log proper. Meanwhile, update the
> > > corresponding selftests.
> > > 
> > > Signed-off-by: Menglong Dong <[email protected]>
> > > Acked-by: Leon Hwang <[email protected]>
> > > ---
> > > v2:
> > > - add a missing FSESSION in bpf_check_attach_target()
> > > ---
> > >  kernel/bpf/verifier.c                               | 10 +++++-----
> > >  tools/testing/selftests/bpf/prog_tests/exceptions.c |  8 ++++----
> > >  tools/testing/selftests/bpf/verifier/sleepable.c    |  2 +-
> > >  3 files changed, 10 insertions(+), 10 deletions(-)
> > > 
> > > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> > > index 594260c1f382..beb660b4c3ec 100644
> > > --- a/kernel/bpf/verifier.c
> > > +++ b/kernel/bpf/verifier.c
> > > @@ -11757,7 +11757,7 @@ static int check_get_func_ip(struct 
> > > bpf_verifier_env *env)
> > >  
> > >   if (type == BPF_PROG_TYPE_TRACING) {
> > >           if (!bpf_prog_has_trampoline(env->prog)) {
> > > -                 verbose(env, "func %s#%d supported only for 
> > > fentry/fexit/fmod_ret programs\n",
> > > +                 verbose(env, "func %s#%d supported only for 
> > > fentry/fexit/fsession/fmod_ret programs\n",
> > >                           func_id_name(func_id), func_id);
> > >                   return -ENOTSUPP;
> > >           }
> > > @@ -25561,7 +25561,7 @@ int bpf_check_attach_target(struct 
> > > bpf_verifier_log *log,
> > >   btf = tgt_prog ? tgt_prog->aux->btf : prog->aux->attach_btf;
> > >   if (!btf) {
> > >           bpf_log(log,
> > > -                 "FENTRY/FEXIT program can only be attached to another 
> > > program annotated with BTF\n");
> > > +                 "FENTRY/FEXIT/FSESSION program can only be attached to 
> > > another program annotated with BTF\n");
> > 
> > I wonder this should say 'Tracing program...' instead,
> > we have other tracing types not covered in this error
> > 
> > jirka
> > 
> > >           return -EINVAL;
> > >   }
> > >   t = btf_type_by_id(btf, btf_id);
> > > @@ -25597,7 +25597,7 @@ int bpf_check_attach_target(struct 
> > > bpf_verifier_log *log,
> > >           if (aux->func && aux->func[subprog]->aux->exception_cb) {
> > >                   bpf_log(log,
> > >                           "%s programs cannot attach to exception 
> > > callback\n",
> > > -                         prog_extension ? "Extension" : "FENTRY/FEXIT");
> > > +                         prog_extension ? "Extension" : 
> > > "FENTRY/FEXIT/FSESSION");
> 
> I guess that we'd better use "Tracing" instead of "FENTRY/FEXIT/FSESSION"
> here too?

ah right lgtm

jirka

Reply via email to