diff options
| author | Jiayuan Chen <jiayuan.chen@linux.dev> | 2026-08-19 20:58:30 +0800 |
|---|---|---|
| committer | Kumar Kartikeya Dwivedi <memxor@gmail.com> | 2026-08-20 20:44:16 +0200 |
| commit | 7ee2f20bf20ed59fb269a260c4c4aff1e67f1b7c (patch) | |
| tree | 6b89842795519fce7698a35d8777bcfb98d7bf07 /include | |
| parent | 150aeba624e8b7cac51c39440d7e8e1fd11de9a0 (diff) | |
| download | linux-7ee2f20bf20ed59fb269a260c4c4aff1e67f1b7c.tar.gz linux-7ee2f20bf20ed59fb269a260c4c4aff1e67f1b7c.zip | |
selftests/bpf: Add reg-invariants test for speculative pointer arithmetic
An unprivileged socket filter does variable pointer arithmetic on a
PTR_TO_MAP_VALUE whose offset collapses to a constant. The Spectre-v1
speculative path used to snapshot the pointer with a const offset and an
unbounded r32, which tripped reg_bounds_sanity_check() on the following
register move.
Mark the test __success_unpriv (the speculative path only runs
unprivileged) and flag it BPF_F_TEST_REG_INVARIANTS so the invariant
violation becomes a hard load failure. The unprivileged run fails without
the verifier fix and passes with it:
verifier_bounds/spec_ptr_alu_const_offset @unpriv:FAIL # without fix
verifier_bounds/spec_ptr_alu_const_offset @unpriv:OK # with fix
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Tested-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/bpf/20260819125840.286434-2-jiayuan.chen@linux.dev
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
