diff options
| author | Alexei Starovoitov <ast@kernel.org> | 2026-06-25 17:54:12 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-06-25 17:55:37 -0700 |
| commit | 26b29f868be647a59b49047d2444c424c5ec2bce (patch) | |
| tree | 09c25af1b721d7b7c77bf792db571d3fb980b170 /tools/include/linux | |
| parent | a91fafbb6dfe9cb779f6b9c3b94142e9f271a042 (diff) | |
| parent | e693da913d2cdd69c1612fbf71bdf2b6771f6dba (diff) | |
Merge branch 'bpf-preserve-scalar-zero-spills-for-stack-reads'
Woojin Ji says:
====================
bpf: Preserve scalar zero spills for stack reads
Changes in v3:
- Apply scalar-zero spill preservation to fixed-offset mixed stack reads as well.
- Remove the var-offset-only flag from mark_reg_stack_read().
- Keep pure register-fill behavior unchanged.
- Add fixed-offset mixed zero/spill-zero selftest coverage.
- Address selftest nits: drop extra unpriv checks, align asm formatting, and remove the pruning-sensitive test.
- Link to v2: https://patch.msgid.link/20260613-bpf-stack-var-off-zero-v1-v2-0-a324af0f00ea@gmail.com
Stack reads currently lose the known-zero fact when loaded bytes come from
a spilled scalar constant zero rather than from STACK_ZERO bytes in some
paths. This series teaches the stack read zero reconstruction path to
preserve that fact while marking the contributing spill slots precise.
The original reproducer used a variable-offset stack byte read emitted by
clang 22.1.6 at -O2/-O3 from a small helper-based BPF C program. Review of
v2 pointed out that fixed-offset reads can benefit as well: pure scalar
zero spill reads were already handled, but a fixed read spanning both
STACK_ZERO and scalar const-zero STACK_SPILL bytes, e.g. 0000ssss, still
fell back to an unknown scalar. v3 handles that mixed fixed-offset case
without changing the existing pure register-fill behavior.
I still do not have a confirmed deployed-program regression, so this stays
targeted at bpf-next.
Tested with:
- make O=../../out/kernel olddefconfig
- make O=../../out/kernel -j$(nproc) kernel/bpf/verifier.o
- make O=../../out/kernel LLVM=1 -j$(nproc) bzImage
- make -C tools/testing/selftests/bpf O=../../../../../out/kernel VMLINUX_BTF=../../../../../out/kernel/vmlinux TEST_KMOD_TARGETS= LLVM=1 -j$(nproc) test_progs
- QEMU guest: ./test_progs -t verifier_var_off -v
Summary: 1/24 PASSED, 0 SKIPPED, 0 FAILED
- QEMU guest: ./test_progs -t verifier_spill_fill -t verifier_live_stack -t verifier_search_pruning -v
Summary: 3/128 PASSED, 0 SKIPPED, 0 FAILED
- QEMU guest: ./veristat -o csv verifier_var_off.bpf.o verifier_spill_fill.bpf.o
Assisted-by: opencode:gpt-5.5
Signed-off-by: Woojin Ji <random6.xyz@gmail.com>
---
====================
Link: https://patch.msgid.link/20260625-bpf-stack-var-off-zero-v1-v3-0-a068210a761b@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/include/linux')
0 files changed, 0 insertions, 0 deletions
