diff options
| author | Alexei Starovoitov <ast@kernel.org> | 2026-10-02 12:47:08 +0000 |
|---|---|---|
| committer | Kumar Kartikeya Dwivedi <memxor@gmail.com> | 2026-10-03 16:08:18 +0200 |
| commit | 9094a158e842323b4487e32e88f01bd45a16af66 (patch) | |
| tree | 64eb7b0d54e296256b912dd8a264a9c1e05d6180 /include/linux/timerqueue.h | |
| parent | 3dc3a91ec9c7184eb5782c86083c7638e60675a0 (diff) | |
| download | linux-next-9094a158e842323b4487e32e88f01bd45a16af66.tar.gz linux-next-9094a158e842323b4487e32e88f01bd45a16af66.zip | |
bpf: Allow a variable in DATASEC that is smaller than its type
LLVM splits a static of a Rust program into pieces. Every piece is a VAR
with the type of the whole static:
[223] STRUCT 'BpfCell<core::option::Option<...>>' size=32 vlen=1
[236] VAR '..scx_cosmos9TASK_CTXS.0' type_id=223, linkage=static
[248] DATASEC '.bss' size=0 vlen=9
type_id=236 offset=24648 size=1 (VAR '..TASK_CTXS.0')
and the kernel rejects such BTF with "Invalid size".
Allow it. The size of a variable in DATASEC is used in two places:
- btf_find_datasec_var() looks for timers, spin locks, kptrs and other
special fields. btf_find_field_one() skips a variable when its size is
not the size of its type, so there are no special fields in a piece.
- btf_datasec_show() prints variables by their types. It would read
past the piece and past the end of the map value when the piece is the
last one. Don't print the pieces.
"global data test #8" and "#10" in prog_tests/btf.c expect "Invalid
size". BTF of both is loaded now. The map of #10 is not created, since
its value is larger than the section.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20261002124714.180012-10-alexei.starovoitov@gmail.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions
