Re: [PATCH bpf-next v6 06/10] bpf: Add verifier support for 16-byte returns in R0:R2
Yonghong Song <[email protected]>
| Newsgroups | org.kernel.vger.bpf |
|---|---|
| Message-ID | <[email protected]> |
On 8/16/26 10:17 PM, [email protected] wrote: >> 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? Okay, I see. Maybe "Return type of %s() has size %u and of %s() size %u, and a size above 8 bytes cannot be replaced\n" ? I guess the intention is to explicitly mention which function exceeds 8 bytes. User should be able to know this by checking original func and freplace prog? > > > --- > 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