public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Menglong Dong <menglong.dong@linux.dev>
To: Menglong Dong <menglong8.dong@gmail.com>,
	Chengkaitao <pilgrimtao@gmail.com>
Cc: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com,
	andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com,
	memxor@gmail.com, song@kernel.org, yonghong.song@linux.dev,
	jolsa@kernel.org, shuah@kernel.org, emil@etsalapatis.com,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH bpf-next 1/3] bpf: add missing fsession to the verifier log
Date: Wed, 08 Apr 2026 18:39:47 +0800	[thread overview]
Message-ID: <2405060.ElGaqSPkdT@7940hx> (raw)
In-Reply-To: <CAAWJmAbhbD68JmFFwL5HLPMVaJyGi1w7hK6t84+DL-snQ+ASmQ@mail.gmail.com>

On 2026/4/8 17:52 Chengkaitao <pilgrimtao@gmail.com> write:
> On Wed, Apr 8, 2026 at 11:16 AM Menglong Dong <menglong8.dong@gmail.com> 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 <dongml2@chinatelecom.cn>
> > ---
> >  kernel/bpf/verifier.c                               | 8 ++++----
> >  tools/testing/selftests/bpf/prog_tests/exceptions.c | 8 ++++----
> >  tools/testing/selftests/bpf/verifier/sleepable.c    | 2 +-
> >  3 files changed, 9 insertions(+), 9 deletions(-)
> >
> > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> > index 594260c1f382..707eaf262307 100644
> > --- a/kernel/bpf/verifier.c
> > +++ b/kernel/bpf/verifier.c
> 
> Some comments in bpf_check_attach_target still need to be added or updated.

Hi, Kaitao. Thanks for the reviewing.

Right, the comments for fsession are not updated, as I'm not sure if
it worth it. There are around a dozen of comments that we
need to update.

Thanks!
Menglong Dong

> 
> Reviewed-by: Kaitao Cheng <chengkaitao@kylinos.cn>
> 
> > @@ -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");
> >                 return -EINVAL;
> >         }
> >         t = btf_type_by_id(btf, btf_id);
> > @@ -25686,7 +25686,7 @@ int bpf_check_attach_target(struct bpf_verifier_log *log,
> >         case BPF_TRACE_RAW_TP:
> >                 if (tgt_prog) {
> >                         bpf_log(log,
> > -                               "Only FENTRY/FEXIT progs are attachable to another BPF prog\n");
> > +                               "Only FENTRY/FEXIT/FSESSION progs are attachable to another BPF prog\n");
> >                         return -EINVAL;
> >                 }
> >                 if (!btf_type_is_typedef(t)) {
> > @@ -25952,7 +25952,7 @@ static int check_attach_btf_id(struct bpf_verifier_env *env)
> >         }
> >
> >         if (prog->sleepable && !can_be_sleepable(prog)) {
> > -               verbose(env, "Only fentry/fexit/fmod_ret, lsm, iter, uprobe, and struct_ops programs can be sleepable\n");
> > +               verbose(env, "Only fentry/fexit/fsession/fmod_ret, lsm, iter, uprobe, and struct_ops programs can be sleepable\n");
> >                 return -EINVAL;
> >         }
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/exceptions.c b/tools/testing/selftests/bpf/prog_tests/exceptions.c
> > index 84ab73e08b0e..94a62fcd4543 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/exceptions.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/exceptions.c
> > @@ -128,7 +128,7 @@ static void test_exceptions_success(void)
> >                                        bpf_program__fd(skel->progs.exception_ext_mod_cb_runtime),
> >                                        "exception_cb_mod"), "set_attach_target"))
> >                                 goto done;
> > -               }), "FENTRY/FEXIT programs cannot attach to exception callback", 0);
> > +               }), "FENTRY/FEXIT/FSESSION programs cannot attach to exception callback", 0);
> >
> >         if (test__start_subtest("throwing fentry -> exception_cb"))
> >                 RUN_EXT(-EINVAL, true, ({
> > @@ -138,7 +138,7 @@ static void test_exceptions_success(void)
> >                                        bpf_program__fd(skel->progs.exception_ext_mod_cb_runtime),
> >                                        "exception_cb_mod"), "set_attach_target"))
> >                                 goto done;
> > -               }), "FENTRY/FEXIT programs cannot attach to exception callback", 0);
> > +               }), "FENTRY/FEXIT/FSESSION programs cannot attach to exception callback", 0);
> >
> >         if (test__start_subtest("non-throwing fexit -> exception_cb"))
> >                 RUN_EXT(-EINVAL, true, ({
> > @@ -148,7 +148,7 @@ static void test_exceptions_success(void)
> >                                        bpf_program__fd(skel->progs.exception_ext_mod_cb_runtime),
> >                                        "exception_cb_mod"), "set_attach_target"))
> >                                 goto done;
> > -               }), "FENTRY/FEXIT programs cannot attach to exception callback", 0);
> > +               }), "FENTRY/FEXIT/FSESSION programs cannot attach to exception callback", 0);
> >
> >         if (test__start_subtest("throwing fexit -> exception_cb"))
> >                 RUN_EXT(-EINVAL, true, ({
> > @@ -158,7 +158,7 @@ static void test_exceptions_success(void)
> >                                        bpf_program__fd(skel->progs.exception_ext_mod_cb_runtime),
> >                                        "exception_cb_mod"), "set_attach_target"))
> >                                 goto done;
> > -               }), "FENTRY/FEXIT programs cannot attach to exception callback", 0);
> > +               }), "FENTRY/FEXIT/FSESSION programs cannot attach to exception callback", 0);
> >
> >         if (test__start_subtest("throwing extension (with custom cb) -> exception_cb"))
> >                 RUN_EXT(-EINVAL, true, ({
> > diff --git a/tools/testing/selftests/bpf/verifier/sleepable.c b/tools/testing/selftests/bpf/verifier/sleepable.c
> > index 1f0d2bdc673f..c2b7f5ebf168 100644
> > --- a/tools/testing/selftests/bpf/verifier/sleepable.c
> > +++ b/tools/testing/selftests/bpf/verifier/sleepable.c
> > @@ -85,7 +85,7 @@
> >         .expected_attach_type = BPF_TRACE_RAW_TP,
> >         .kfunc = "sched_switch",
> >         .result = REJECT,
> > -       .errstr = "Only fentry/fexit/fmod_ret, lsm, iter, uprobe, and struct_ops programs can be sleepable",
> > +       .errstr = "Only fentry/fexit/fsession/fmod_ret, lsm, iter, uprobe, and struct_ops programs can be sleepable",
> >         .flags = BPF_F_SLEEPABLE,
> >         .runs = -1,
> >  },
> > --
> > 2.53.0
> >
> >
> 
> 
> -- 
> Yours,
> Chengkaitao
> 





  reply	other threads:[~2026-04-08 10:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-08  3:14 [PATCH bpf-next 0/3] bpf: add the missing fsession Menglong Dong
2026-04-08  3:14 ` [PATCH bpf-next 1/3] bpf: add missing fsession to the verifier log Menglong Dong
2026-04-08  4:55   ` bot+bpf-ci
2026-04-08  5:52     ` Menglong Dong
2026-04-08  9:52   ` Chengkaitao
2026-04-08 10:39     ` Menglong Dong [this message]
2026-04-08  3:14 ` [PATCH bpf-next 2/3] docs/bpf: add missing fsession attach type to docs Menglong Dong
2026-04-08  3:14 ` [PATCH bpf-next 3/3] bpftool: add missing fsession to the usage and docs of bpftool Menglong Dong
2026-04-08  4:27 ` [PATCH bpf-next 0/3] bpf: add the missing fsession Leon Hwang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2405060.ElGaqSPkdT@7940hx \
    --to=menglong.dong@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=menglong8.dong@gmail.com \
    --cc=pilgrimtao@gmail.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox