]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bpf: Improve ctx access verifier error message
authorPaul Chaignon <paul.chaignon@gmail.com>
Fri, 1 Aug 2025 09:49:15 +0000 (11:49 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 1 Aug 2025 16:22:44 +0000 (09:22 -0700)
We've already had two "error during ctx access conversion" warnings
triggered by syzkaller. Let's improve the error message by dumping the
cnt variable so that we can more easily differentiate between the
different error cases.

Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/cc94316c30dd76fae4a75a664b61a2dbfe68e205.1754039605.git.paul.chaignon@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c

index 399f03e625086481316744e9fa58b9e7cf21703b..0806295945e4006bae53513570f1c75545228c8d 100644 (file)
@@ -21445,7 +21445,7 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env)
                                         &target_size);
                if (cnt == 0 || cnt >= INSN_BUF_SIZE ||
                    (ctx_field_size && !target_size)) {
-                       verifier_bug(env, "error during ctx access conversion");
+                       verifier_bug(env, "error during ctx access conversion (%d)", cnt);
                        return -EFAULT;
                }