]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bpf: add missing fsession to the verifier log
authorMenglong Dong <menglong8.dong@gmail.com>
Sun, 12 Apr 2026 06:03:44 +0000 (14:03 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 12 Apr 2026 19:42:38 +0000 (12:42 -0700)
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.

Acked-by: Leon Hwang <leon.hwang@linux.dev>
Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
Link: https://lore.kernel.org/r/20260412060346.142007-2-dongml2@chinatelecom.cn
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c
tools/testing/selftests/bpf/prog_tests/exceptions.c
tools/testing/selftests/bpf/verifier/sleepable.c

index 817eb7815011b446017735cf1f1bc48755c93807..4fa9d2bc07f6fb1ac0c08dda7359847cc16f49dd 100644 (file)
@@ -10152,7 +10152,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;
                }
@@ -19135,7 +19135,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");
+                       "Tracing program can only be attached to another program annotated with BTF\n");
                return -EINVAL;
        }
        t = btf_type_by_id(btf, btf_id);
@@ -19171,7 +19171,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" : "Tracing");
                        return -EINVAL;
                }
                conservative = aux->func_info_aux[subprog].unreliable;
@@ -19260,7 +19260,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)) {
@@ -19526,7 +19526,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;
        }
 
index 84ab73e08b0e646b06d0325dc996475d1d5fc514..e8cbaf2a3e82e86d7a56a558b507d1a66ff0a441 100644 (file)
@@ -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);
+               }), "Tracing 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);
+               }), "Tracing 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);
+               }), "Tracing 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);
+               }), "Tracing programs cannot attach to exception callback", 0);
 
        if (test__start_subtest("throwing extension (with custom cb) -> exception_cb"))
                RUN_EXT(-EINVAL, true, ({
index 1f0d2bdc673f6e84e8e44be96c72977da0f73ab7..c2b7f5ebf168cc52661a30694dac16164d1c7f62 100644 (file)
@@ -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,
 },