Skip to contentSkip to conversation

bpf: add the missing fsession

PATCH Superseded Menglong Dong 5 participants 10 messages Apr 8 – Apr 9

Subsystems (6)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover bpf: add the missing fsession

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

Changes since v1:
- add a missing FSESSION in bpf_check_attach_target() in the 1st patch

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                               | 10 +++++-----
 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, 19 insertions(+), 15 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

PATCH v2 1/3 bpf: add missing fsession to the verifier log

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.

---
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(-)
kernel/bpf/verifier.c +5 -5
index 594260c1f382..beb660b4c3ec 100644
@@ -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);
@@ -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");
 			return -EINVAL;
 		}
 		conservative = aux->func_info_aux[subprog].unreliable;
@@ -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;
 	}
 
tools/testing/selftests/bpf/prog_tests/exceptions.c +4 -4
index 84ab73e08b0e..94a62fcd4543 100644
@@ -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, ({
tools/testing/selftests/bpf/verifier/sleepable.c +1 -1
index 1f0d2bdc673f..c2b7f5ebf168 100644
@@ -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,
 },
Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH bpf-next v2 1/3] bpf: add missing fsession to the verifier log

Quoted 30 lines · Menglong Dong

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.

---
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(-)
kernel/bpf/verifier.c +1 -1
index 594260c1f382..beb660b4c3ec 100644
@@ -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;
 		}

kernel/bpf/verifier.c int bpf_check_attach_target(struct bpf_verifier_log *log, · line 25564

Quoted 5 lines
kernel/bpf/verifier.c +1 -1
@@ -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

Quoted 86 lines
kernel/bpf/verifier.c +3 -3
 		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");
 			return -EINVAL;
 		}
 		conservative = aux->func_info_aux[subprog].unreliable;
@@ -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;
 	}
 
tools/testing/selftests/bpf/prog_tests/exceptions.c +4 -4
index 84ab73e08b0e..94a62fcd4543 100644
@@ -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, ({
tools/testing/selftests/bpf/verifier/sleepable.c +1 -1
index 1f0d2bdc673f..c2b7f5ebf168 100644
@@ -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,
 },
Signature · 1 line
2.53.0
#3 lore raw

Re: [PATCH bpf-next v2 1/3] bpf: add missing fsession to the verifier log

Quoted 24 lines · Jiri Olsa
Quoted 22 lines · Menglong Dong

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.

---
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(-)
kernel/bpf/verifier.c +0 -0
index 594260c1f382..beb660b4c3ec 100644
@@ -11757,7 +11757,7 @@ static int check_get_func_ip(struct bpf_verifier_env *env)
 
Quoted 16 lines

kernel/bpf/verifier.c int bpf_check_attach_target(struct bpf_verifier_log *log, · line 25564

Quoted 13 lines
kernel/bpf/verifier.c +2 -2
      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

+1

pw-bot: cr

#4 lore raw

Re: [PATCH bpf-next v2 1/3] bpf: add missing fsession to the verifier log

In reply to Jiri Olsa

On 2026/4/8 21:21 Jiri Olsa <[email protected]> write:

Quoted 23 lines · Menglong Dong
Quoted 22 lines

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.

---
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(-)
kernel/bpf/verifier.c +0 -0
index 594260c1f382..beb660b4c3ec 100644
@@ -11757,7 +11757,7 @@ static int check_get_func_ip(struct bpf_verifier_env *env)
 
Quoted 16 lines

kernel/bpf/verifier.c int bpf_check_attach_target(struct bpf_verifier_log *log, · line 25564

Quoted 13 lines
kernel/bpf/verifier.c +2 -2
 	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

Yeah, it make sense. I'll update it in V3.

Thanks!
Menglong Dong

Quoted 91 lines

jirka

Quoted 86 lines
kernel/bpf/verifier.c +3 -3
 		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");
 			return -EINVAL;
 		}
 		conservative = aux->func_info_aux[subprog].unreliable;
@@ -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;
 	}
 
tools/testing/selftests/bpf/prog_tests/exceptions.c +4 -4
index 84ab73e08b0e..94a62fcd4543 100644
@@ -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, ({
tools/testing/selftests/bpf/verifier/sleepable.c +1 -1
index 1f0d2bdc673f..c2b7f5ebf168 100644
@@ -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,
 },
Signature · 1 line
2.53.0
#5 lore raw

Re: [PATCH bpf-next v2 1/3] bpf: add missing fsession to the verifier log

In reply to Jiri Olsa

On 2026/4/8 21:21 Jiri Olsa <[email protected]> write:

Quoted 42 lines · Menglong Dong
Quoted 30 lines

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.

---
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(-)
kernel/bpf/verifier.c +1 -1
index 594260c1f382..beb660b4c3ec 100644
@@ -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;
 		}

kernel/bpf/verifier.c int bpf_check_attach_target(struct bpf_verifier_log *log, · line 25564

Quoted 5 lines
kernel/bpf/verifier.c +1 -1
@@ -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

Quoted 9 lines

kernel/bpf/verifier.c int bpf_check_attach_target(struct bpf_verifier_log *log, · line 25600

Quoted 9 lines
kernel/bpf/verifier.c +1 -1
 		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?

Quoted 2 lines
Quoted 2 lines
kernel/bpf/verifier.c +0 -0
 			return -EINVAL;
 		}

[...]

Quoted 2 lines
#6 lore raw

Re: [PATCH bpf-next v2 1/3] bpf: add missing fsession to the verifier log

Quoted 43 lines · Menglong Dong

On 2026/4/8 21:21 Jiri Olsa <[email protected]> write:

Quoted 42 lines · Menglong Dong
Quoted 30 lines

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.

---
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(-)
kernel/bpf/verifier.c +1 -1
index 594260c1f382..beb660b4c3ec 100644
@@ -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;
 		}

kernel/bpf/verifier.c int bpf_check_attach_target(struct bpf_verifier_log *log, · line 25564

Quoted 5 lines
kernel/bpf/verifier.c +1 -1
@@ -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

Quoted 12 lines
Quoted 9 lines

kernel/bpf/verifier.c int bpf_check_attach_target(struct bpf_verifier_log *log, · line 25600

Quoted 9 lines
kernel/bpf/verifier.c +1 -1
 		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

#7 lore raw

PATCH v2 2/3 docs/bpf: add missing fsession attach type to docs

In reply to Menglong Dong

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

---
 Documentation/bpf/drgn.rst                 | 4 ++--
 Documentation/bpf/libbpf/program_types.rst | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
Documentation/bpf/drgn.rst +2 -2
index 41f223c3161e..cabf702eb75a 100644
@@ -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
 ===============
Documentation/bpf/libbpf/program_types.rst +4 -0
index 3b837522834b..3a07ce3b7f79 100644
@@ -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       |
Signature · 1 line
2.53.0
#8 lore raw

PATCH v2 3/3 bpftool: add missing fsession to the usage and docs of bpftool

In reply to Menglong Dong

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.

---
 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(-)
tools/bpf/bpftool/Documentation/bpftool-prog.rst +1 -1
index 35aeeaf5f711..90fa2a48cc26 100644
@@ -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** |
tools/bpf/bpftool/bash-completion/bpftool +1 -1
index babb0d4e9753..75cbcb512eba 100644
@@ -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
                             ;;
tools/bpf/bpftool/prog.c +1 -1
index 6daf19809ca4..a9f730d407a9 100644
@@ -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"
Signature · 1 line
2.53.0