summaryrefslogtreecommitdiff
path: root/scripts/basic/split-include.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-11-01 19:05:18 +0000
committerAlexei Starovoitov <ast@kernel.org>2026-11-02 00:10:39 +0000
commited02b9cc1d377d03da2507c3a858f0874aef7494 (patch)
tree9d35e269501bcb5dcb3c0292b4e92f8027ec8f40 /scripts/basic/split-include.c
parent07684726d39e56c1c800d3b3e51915fb0975a46d (diff)
downloadlinux-ed02b9cc1d377d03da2507c3a858f0874aef7494.tar.gz
linux-ed02b9cc1d377d03da2507c3a858f0874aef7494.zip
bpf: Don't turn kfunc arguments of an empty struct type into memory
A kfunc can take a pointer to a struct that has only scalar members. Then the verifier also accepts memory of the prog: resolve_func_arg_type() changes ARG_PTR_TO_BTF_ID to memory of the size of the struct. An empty struct meets this condition too. But it is a handle for an object of another type. The io_uring kfuncs cast the empty struct iou_ctx to struct io_ring_ctx. Thus they use memory of the prog as a struct io_ring_ctx. Keep ARG_PTR_TO_BTF_ID for a pointer to an empty struct. Then the verifier accepts only a PTR_TO_BTF_ID of that struct, such as the ctx argument of loop_step(). Only one other kfunc takes an empty struct, struct bpf_ws_lock. It releases this argument, and the verifier does not change an argument that the kfunc releases. Add the rule to kfuncs.rst. Fixes: ec02fe217fa6 ("io_uring/bpf-ops: restrict ctx access to BPF") Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261101190535.1454146-11-alexei.starovoitov@gmail.com
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions