diff options
| author | Yonghong Song <yonghong.song@linux.dev> | 2026-09-12 12:52:27 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-09-12 20:54:18 -0700 |
| commit | 00cfeb9554e2513cc721acdf5679bd26dcf24e02 (patch) | |
| tree | c5725a15556b62867c253d080fc15530e62b92dd /kernel | |
| parent | 4dd676ca5b7a3bdc18e217bdd618c5e73016aee4 (diff) | |
| download | linux-next-00cfeb9554e2513cc721acdf5679bd26dcf24e02.tar.gz linux-next-00cfeb9554e2513cc721acdf5679bd26dcf24e02.zip | |
bpf: Support __int128 as a by-value function argument
A 128-bit integer follows the same calling convention as a 16-byte
by-value struct: LLVM emits it as a 16-byte BTF_KIND_INT and passes it in
two consecutive argument registers. So a __int128 gets its two slots.
The test added at the start of the series, which recorded the wrong
register map as an R4 !read_ok rejection, now passes and is flipped to
__success.
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20260912195227.987991-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/bpf/btf.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index c560ee0c4347..9f8a4e4aac3b 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -8264,11 +8264,7 @@ skip_pointer: bpf_log(log, "arg#%d has pointer tag, but is not a pointer type\n", i); return -EINVAL; } - if (btf_type_is_int(t) || btf_is_any_enum(t)) { - sub->args[slots_used++].arg_type = ARG_SCALAR; - continue; - } - if (btf_type_is_struct(t)) { + if (btf_type_is_int(t) || btf_is_any_enum(t) || btf_type_is_struct(t)) { u32 nslots; if (!t->size || t->size > 2 * BPF_REG_SIZE) { @@ -8280,7 +8276,8 @@ skip_pointer: i, btf_type_str(t), tname, t->size, 2 * BPF_REG_SIZE); return -EINVAL; } - if (!btf_struct_is_composed_of(env, btf, t, BTF_MEMBER_SCALAR)) { + if (btf_type_is_struct(t) && + !btf_struct_is_composed_of(env, btf, t, BTF_MEMBER_SCALAR)) { if (!is_global) return -EINVAL; bpf_log(log, "Arg#%d type %s in %s() is not composed of scalars\n", |
