diff options
| author | Kumar Kartikeya Dwivedi <memxor@gmail.com> | 2026-09-04 12:41:56 +0200 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-09-04 12:24:25 -0700 |
| commit | ecdc5043794c9184aa8e6c814603899479c46b35 (patch) | |
| tree | da2d125a692419990c1e0564e0f97f8a8c265c3b /scripts/Makefile.thinlto | |
| parent | 2b97956af60810cd382b86b9ce9aea421b889861 (diff) | |
| download | linux-ecdc5043794c9184aa8e6c814603899479c46b35.tar.gz linux-ecdc5043794c9184aa8e6c814603899479c46b35.zip | |
bpf: Mark NULL kptr stores precise
check_map_kptr_access() permits a scalar store into an untrusted kptr
field only when the register is known to contain zero. Unlike other
verifier checks whose outcome depends on a scalar value, it does not mark
that register precise.
A state checkpoint reached with an imprecise zero can therefore prune a
second path that reaches the store with an arbitrary nonzero scalar. The
program can write attacker-controlled bits into the kptr field and load
them back as a PTR_TO_BTF_ID.
Call mark_chain_precision() before accepting a known-zero register. This
forces state equivalence to compare its scalar range and makes the verifier
visit and reject a path carrying a nonzero value.
Fixes: 61df10c7799e ("bpf: Allow storing unreferenced kptr in map")
Reported-by: Nicholas Carlini <npc@anthropic.com>
Suggested-by: Nicholas Carlini <npc@anthropic.com>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20260904104203.345917-6-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
