diff options
| author | Kumar Kartikeya Dwivedi <memxor@gmail.com> | 2026-09-21 04:38:28 +0200 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-09-21 17:12:39 +0000 |
| commit | fc670d4b6c31d69f5e872a397d17fe4c5f970ffe (patch) | |
| tree | aac92580b9d1a476281c2e4aaac6588af979b1be /tools/testing/selftests/bpf/test_cpp.cpp | |
| parent | fc8dc2be101b038adf6c36c51511a53ca2407199 (diff) | |
| download | linux-next-fc670d4b6c31d69f5e872a397d17fe4c5f970ffe.tar.gz linux-next-fc670d4b6c31d69f5e872a397d17fe4c5f970ffe.zip | |
bpf: Fix generic __uninit kfunc output buffers
Stack liveness treats __uninit kfunc arguments as writes. Even with
write-only access checks, ordinary clobber handling leaves poisoned stack
bytes poisoned after the call, so the output cannot be read.
Reuse the helper output descriptor for generic kfunc buffers. Record the
output after resolving its memory type, and initialize its stack bytes
only after all arguments have been checked. This prevents an output from
making an aliased, uninitialized input appear valid.
Track the output by its ABI argument slot, since a kfunc pointer may be
passed on the stack or follow a multi-slot by-value argument. Keep the
single-output restriction in prototype validation; multiple-output
tracking is a separate extension.
Document that output buffers must be fully initialized on every return
path, including error returns and padding.
Fixes: 2cb27158adb3 ("bpf: poison dead stack slots")
Reported-by: Tejun Heo <tj@kernel.org>
Suggested-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/bpf/86d966ec88bbf27d21b2bb4e18c8aa00@kernel.org
Link: https://patch.msgid.link/20260921023843.411943-5-memxor@gmail.com
Diffstat (limited to 'tools/testing/selftests/bpf/test_cpp.cpp')
0 files changed, 0 insertions, 0 deletions
