Re: [PATCH bpf-next v6 06/10] bpf: Add verifier support for 16-byte returns in R0:R2
| Newsgroups | org.kernel.vger.bpf |
|---|---|
| Message-ID | <7549f24ead00d59b53a11482de59a7858aa1fe8118b41f7449887ee9b544b0c8@mail.kernel.org> |
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 5b9d767895c9..2ae7cb9b30f2 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -7684,6 +7684,12 @@ static int btf_check_func_type_match(struct bpf_verifier_log *log,
> btf_type_str(t2), fn2);
> return -EINVAL;
> }
> + if (btf_type_has_size(t1) && (t1->size > 8 || t2->size > 8)) {
> + bpf_log(log,
> + "Return type of %s() has size %u while %s() has size %u, and a size above 8 bytes cannot be replaced\n",
> + fn1, t1->size, fn2, t2->size);
> + return -EINVAL;
> + }
This isn't a bug, but since this check fires on the absolute size rather
than on a mismatch, the message can end up reading "has size 16 while g()
has size 16". Would it be clearer to state which side exceeds 8 bytes
instead of using the "X while Y" mismatch phrasing the neighbouring
diagnostics use?
---
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/31995069373