diff options
| author | Yonghong Song <yonghong.song@linux.dev> | 2026-09-12 12:52:21 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-09-12 20:54:18 -0700 |
| commit | 4dd676ca5b7a3bdc18e217bdd618c5e73016aee4 (patch) | |
| tree | 76e930454c71b1b2f18c89be3e60783cf288e272 /include/linux | |
| parent | 3f1023cab8130e8d43271b57d36139273a6c48a0 (diff) | |
| download | linux-next-4dd676ca5b7a3bdc18e217bdd618c5e73016aee4.tar.gz linux-next-4dd676ca5b7a3bdc18e217bdd618c5e73016aee4.zip | |
bpf: Support by-value struct arguments up to 16 bytes
A global function taking a struct or union by value is rejected today:
Arg#1 type STRUCT in tar() is not supported yet.
Accept one of at most 16 bytes, which arrives in one or two consecutive
argument registers. Only structs composed entirely of scalars are taken
for now; btf_struct_is_composed_of() enforces that.
The slots of a value are independent of each other, so the compiler may
split one across the last argument register and the stack, as in
static void f(int a, int b, int c, int d, struct pair p);
or place it wholly past the registers, and the verifier describes either
the same way. What has to follow the slots is stack_arg_cnt, recomputed
from the slots consumed, together with the "no stack args in global
functions" and JIT support checks, and the MAX_BPF_FUNC_ARGS bound, which
now has to account for a parameter that takes two slots at once.
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20260912195221.987808-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
