public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/3] bpf: add the missing fsession
@ 2026-04-08  3:14 Menglong Dong
  2026-04-08  3:14 ` [PATCH bpf-next 1/3] bpf: add missing fsession to the verifier log Menglong Dong
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Menglong Dong @ 2026-04-08  3:14 UTC (permalink / raw)
  To: ast
  Cc: daniel, john.fastabend, andrii, martin.lau, eddyz87, memxor, song,
	yonghong.song, jolsa, shuah, emil, bpf, linux-kernel,
	linux-kselftest

Add the missing fsession attach type to the BPF docs, verifier log and
bpftool.

Menglong Dong (3):
  bpf: add missing fsession to the verifier log
  docs/bpf: add missing fsession attach type to docs
  bpftool: add missing fsession to the usage and docs of bpftool

 Documentation/bpf/drgn.rst                          | 4 ++--
 Documentation/bpf/libbpf/program_types.rst          | 4 ++++
 kernel/bpf/verifier.c                               | 8 ++++----
 tools/bpf/bpftool/Documentation/bpftool-prog.rst    | 2 +-
 tools/bpf/bpftool/bash-completion/bpftool           | 2 +-
 tools/bpf/bpftool/prog.c                            | 2 +-
 tools/testing/selftests/bpf/prog_tests/exceptions.c | 8 ++++----
 tools/testing/selftests/bpf/verifier/sleepable.c    | 2 +-
 8 files changed, 18 insertions(+), 14 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH bpf-next 1/3] bpf: add missing fsession to the verifier log
  2026-04-08  3:14 [PATCH bpf-next 0/3] bpf: add the missing fsession Menglong Dong
@ 2026-04-08  3:14 ` Menglong Dong
  2026-04-08  4:55   ` bot+bpf-ci
  2026-04-08  9:52   ` Chengkaitao
  2026-04-08  3:14 ` [PATCH bpf-next 2/3] docs/bpf: add missing fsession attach type to docs Menglong Dong
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Menglong Dong @ 2026-04-08  3:14 UTC (permalink / raw)
  To: ast
  Cc: daniel, john.fastabend, andrii, martin.lau, eddyz87, memxor, song,
	yonghong.song, jolsa, shuah, emil, bpf, linux-kernel,
	linux-kselftest

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
@@ -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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH bpf-next 2/3] docs/bpf: add missing fsession attach type to docs
  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  3:14 ` 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
  3 siblings, 0 replies; 9+ messages in thread
From: Menglong Dong @ 2026-04-08  3:14 UTC (permalink / raw)
  To: ast
  Cc: daniel, john.fastabend, andrii, martin.lau, eddyz87, memxor, song,
	yonghong.song, jolsa, shuah, emil, bpf, linux-kernel,
	linux-kselftest

Add the fsession attach type to program_types.rst and drgn.rst.

Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
---
 Documentation/bpf/drgn.rst                 | 4 ++--
 Documentation/bpf/libbpf/program_types.rst | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Documentation/bpf/drgn.rst b/Documentation/bpf/drgn.rst
index 41f223c3161e..cabf702eb75a 100644
--- a/Documentation/bpf/drgn.rst
+++ b/Documentation/bpf/drgn.rst
@@ -26,8 +26,8 @@ about these objects, including id, type and name.
 
 The main use-case `bpf_inspect.py`_ covers is to show BPF programs of types
 ``BPF_PROG_TYPE_EXT`` and ``BPF_PROG_TYPE_TRACING`` attached to other BPF
-programs via ``freplace``/``fentry``/``fexit`` mechanisms, since there is no
-user-space API to get this information.
+programs via ``freplace``/``fentry``/``fexit``/``fsession`` mechanisms, since
+there is no user-space API to get this information.
 
 Getting started
 ===============
diff --git a/Documentation/bpf/libbpf/program_types.rst b/Documentation/bpf/libbpf/program_types.rst
index 3b837522834b..3a07ce3b7f79 100644
--- a/Documentation/bpf/libbpf/program_types.rst
+++ b/Documentation/bpf/libbpf/program_types.rst
@@ -207,6 +207,10 @@ described in more detail in the footnotes.
 +                                           +                                        +----------------------------------+-----------+
 |                                           |                                        | ``fexit.s+`` [#fentry]_          | Yes       |
 +                                           +----------------------------------------+----------------------------------+-----------+
+|                                           | ``BPF_TRACE_FSESSION``                 | ``fsession+`` [#fentry]_         |           |
++                                           +                                        +----------------------------------+-----------+
+|                                           |                                        | ``fsession.s+`` [#fentry]_       | Yes       |
++                                           +----------------------------------------+----------------------------------+-----------+
 |                                           | ``BPF_TRACE_ITER``                     | ``iter+`` [#iter]_               |           |
 +                                           +                                        +----------------------------------+-----------+
 |                                           |                                        | ``iter.s+`` [#iter]_             | Yes       |
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH bpf-next 3/3] bpftool: add missing fsession to the usage and docs of bpftool
  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  3:14 ` [PATCH bpf-next 2/3] docs/bpf: add missing fsession attach type to docs Menglong Dong
@ 2026-04-08  3:14 ` Menglong Dong
  2026-04-08  4:27 ` [PATCH bpf-next 0/3] bpf: add the missing fsession Leon Hwang
  3 siblings, 0 replies; 9+ messages in thread
From: Menglong Dong @ 2026-04-08  3:14 UTC (permalink / raw)
  To: ast
  Cc: daniel, john.fastabend, andrii, martin.lau, eddyz87, memxor, song,
	yonghong.song, jolsa, shuah, emil, bpf, linux-kernel,
	linux-kselftest

Add the fsession attach type to the usage of bpftool in do_help().
Meanwhile, add it to the bash-completion and bpftool-prog.rst too.

Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
---
 tools/bpf/bpftool/Documentation/bpftool-prog.rst | 2 +-
 tools/bpf/bpftool/bash-completion/bpftool        | 2 +-
 tools/bpf/bpftool/prog.c                         | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/bpf/bpftool/Documentation/bpftool-prog.rst b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
index 35aeeaf5f711..90fa2a48cc26 100644
--- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst
+++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
@@ -54,7 +54,7 @@ PROG COMMANDS
 |     **cgroup/sendmsg4** | **cgroup/sendmsg6** | **cgroup/sendmsg_unix** |
 |     **cgroup/recvmsg4** | **cgroup/recvmsg6** | **cgroup/recvmsg_unix** | **cgroup/sysctl** |
 |     **cgroup/getsockopt** | **cgroup/setsockopt** | **cgroup/sock_release** |
-|     **struct_ops** | **fentry** | **fexit** | **freplace** | **sk_lookup**
+|     **struct_ops** | **fentry** | **fexit** | **fsession** | **freplace** | **sk_lookup**
 | }
 | *ATTACH_TYPE* := {
 |     **sk_msg_verdict** | **sk_skb_verdict** | **sk_skb_stream_verdict** |
diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool
index babb0d4e9753..75cbcb512eba 100644
--- a/tools/bpf/bpftool/bash-completion/bpftool
+++ b/tools/bpf/bpftool/bash-completion/bpftool
@@ -501,7 +501,7 @@ _bpftool()
                                 cgroup/post_bind4 cgroup/post_bind6 \
                                 cgroup/sysctl cgroup/getsockopt \
                                 cgroup/setsockopt cgroup/sock_release struct_ops \
-                                fentry fexit freplace sk_lookup'
+                                fentry fexit fsession freplace sk_lookup'
                             COMPREPLY=( $( compgen -W "$BPFTOOL_PROG_LOAD_TYPES" -- "$cur" ) )
                             return 0
                             ;;
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 6daf19809ca4..a9f730d407a9 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -2583,7 +2583,7 @@ static int do_help(int argc, char **argv)
 		"                 cgroup/getsockname_unix | cgroup/sendmsg4 | cgroup/sendmsg6 |\n"
 		"                 cgroup/sendmsg_unix | cgroup/recvmsg4 | cgroup/recvmsg6 | cgroup/recvmsg_unix |\n"
 		"                 cgroup/getsockopt | cgroup/setsockopt | cgroup/sock_release |\n"
-		"                 struct_ops | fentry | fexit | freplace | sk_lookup }\n"
+		"                 struct_ops | fentry | fexit | fsession | freplace | sk_lookup }\n"
 		"       ATTACH_TYPE := { sk_msg_verdict | sk_skb_verdict | sk_skb_stream_verdict |\n"
 		"                        sk_skb_stream_parser | flow_dissector }\n"
 		"       METRIC := { cycles | instructions | l1d_loads | llc_misses | itlb_misses | dtlb_misses }\n"
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH bpf-next 0/3] bpf: add the missing fsession
  2026-04-08  3:14 [PATCH bpf-next 0/3] bpf: add the missing fsession Menglong Dong
                   ` (2 preceding siblings ...)
  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 ` Leon Hwang
  3 siblings, 0 replies; 9+ messages in thread
From: Leon Hwang @ 2026-04-08  4:27 UTC (permalink / raw)
  To: Menglong Dong, ast
  Cc: daniel, john.fastabend, andrii, martin.lau, eddyz87, memxor, song,
	yonghong.song, jolsa, shuah, emil, bpf, linux-kernel,
	linux-kselftest

On 8/4/26 11:14, Menglong Dong wrote:
> Add the missing fsession attach type to the BPF docs, verifier log and
> bpftool.
> 
Acked-by: Leon Hwang <leon.hwang@linux.dev>

[...]


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH bpf-next 1/3] bpf: add missing fsession to the verifier log
  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
  1 sibling, 1 reply; 9+ messages in thread
From: bot+bpf-ci @ 2026-04-08  4:55 UTC (permalink / raw)
  To: menglong8.dong, ast
  Cc: daniel, john.fastabend, andrii, martin.lau, eddyz87, memxor, song,
	yonghong.song, jolsa, shuah, emil, bpf, linux-kernel,
	linux-kselftest, ast, andrii, daniel, martin.lau, eddyz87,
	yonghong.song, clm, ihor.solodrai

[-- Attachment #1: Type: text/plain, Size: 1652 bytes --]

> diff --git a/tools/testing/selftests/bpf/prog_tests/exceptions.c b/tools/testing/selftests/bpf/prog_tests/exceptions.c
> index 84ab73e08b0e6..94a62fcd4543d 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);

These four selftest locations now expect the string
"FENTRY/FEXIT/FSESSION programs cannot attach to exception callback",
but the verifier message they match against was not updated. In
bpf_check_attach_target() the format string still reads:

    prog_extension ? "Extension" : "FENTRY/FEXIT");

so the kernel produces "FENTRY/FEXIT programs cannot attach to
exception callback". The RUN_EXT macro uses strstr() to match the
expected string against the kernel log buffer, and since
"FENTRY/FEXIT/FSESSION" is not a substring of "FENTRY/FEXIT programs",
strstr() returns NULL and the ASSERT_OK_PTR fails.

Should the verifier message also be updated to include FSESSION, to
match the selftest expectation? As it stands these four subtests will
fail.

> [ ... ]


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/24117471086

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH bpf-next 1/3] bpf: add missing fsession to the verifier log
  2026-04-08  4:55   ` bot+bpf-ci
@ 2026-04-08  5:52     ` Menglong Dong
  0 siblings, 0 replies; 9+ messages in thread
From: Menglong Dong @ 2026-04-08  5:52 UTC (permalink / raw)
  To: menglong8.dong, bot+bpf-ci
  Cc: ast, daniel, john.fastabend, andrii, martin.lau, eddyz87, memxor,
	song, yonghong.song, jolsa, shuah, emil, bpf, linux-kernel,
	linux-kselftest, ast, andrii, daniel, martin.lau, eddyz87,
	yonghong.song, clm, ihor.solodrai

On 2026/4/8 12:55 bot+bpf-ci@kernel.org write:
> > diff --git a/tools/testing/selftests/bpf/prog_tests/exceptions.c b/tools/testing/selftests/bpf/prog_tests/exceptions.c
> > index 84ab73e08b0e6..94a62fcd4543d 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);
> 
> These four selftest locations now expect the string
> "FENTRY/FEXIT/FSESSION programs cannot attach to exception callback",
> but the verifier message they match against was not updated. In
> bpf_check_attach_target() the format string still reads:
> 
>     prog_extension ? "Extension" : "FENTRY/FEXIT");

You are right, I missed this part. I'll update it in the V2.

Thanks!
Menglong Dong

> 
> so the kernel produces "FENTRY/FEXIT programs cannot attach to
> exception callback". The RUN_EXT macro uses strstr() to match the
> expected string against the kernel log buffer, and since
> "FENTRY/FEXIT/FSESSION" is not a substring of "FENTRY/FEXIT programs",
> strstr() returns NULL and the ASSERT_OK_PTR fails.
> 
> Should the verifier message also be updated to include FSESSION, to
> match the selftest expectation? As it stands these four subtests will
> fail.
> 
> > [ ... ]
> 
> 
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
> 
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/24117471086





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH bpf-next 1/3] bpf: add missing fsession to the verifier log
  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  9:52   ` Chengkaitao
  2026-04-08 10:39     ` Menglong Dong
  1 sibling, 1 reply; 9+ messages in thread
From: Chengkaitao @ 2026-04-08  9:52 UTC (permalink / raw)
  To: Menglong Dong
  Cc: ast, daniel, john.fastabend, andrii, martin.lau, eddyz87, memxor,
	song, yonghong.song, jolsa, shuah, emil, bpf, linux-kernel,
	linux-kselftest

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.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH bpf-next 1/3] bpf: add missing fsession to the verifier log
  2026-04-08  9:52   ` Chengkaitao
@ 2026-04-08 10:39     ` Menglong Dong
  0 siblings, 0 replies; 9+ messages in thread
From: Menglong Dong @ 2026-04-08 10:39 UTC (permalink / raw)
  To: Menglong Dong, Chengkaitao
  Cc: ast, daniel, john.fastabend, andrii, martin.lau, eddyz87, memxor,
	song, yonghong.song, jolsa, shuah, emil, bpf, linux-kernel,
	linux-kselftest

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
> 





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-04-08 10:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox