All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf v4 0/2] bpf: Fix unsound scalar forking for BPF_OR
@ 2026-03-14  2:15 Daniel Wade
  2026-03-14  2:15 ` [PATCH bpf v4 1/2] bpf: Fix unsound scalar forking in maybe_fork_scalars() " Daniel Wade
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel Wade @ 2026-03-14  2:15 UTC (permalink / raw)
  To: bpf; +Cc: daniel, eddyz87, ameryhung, ast, danjwade95

maybe_fork_scalars() unconditionally sets the pushed path dst register
to 0 for both BPF_AND and BPF_OR.  For AND this is correct (0 & K == 0),
but for OR it is wrong (0 | K == K, not 0).  This causes the verifier to
track an incorrect value on the pushed path, leading to a verifier/runtime
divergence that allows out-of-bounds map value access.

v4: Use block comment style for multi-line comments in selftests (Amery Hung)
    Add Reviewed-by/Acked-by tags
v3: Use single-line comment style in selftests (Alexei Starovoitov)
v2: Use push_stack(env, env->insn_idx, ...) to re-execute the insn
    on the pushed path (Eduard Zingerman)

Daniel Wade (2):
  bpf: Fix unsound scalar forking in maybe_fork_scalars() for BPF_OR
  selftests/bpf: Add tests for maybe_fork_scalars() OR vs AND handling

 kernel/bpf/verifier.c                         |  2 +-
 .../selftests/bpf/progs/verifier_bounds.c     | 94 +++++++++++++++++++
 2 files changed, 95 insertions(+), 1 deletion(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-21 20:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-14  2:15 [PATCH bpf v4 0/2] bpf: Fix unsound scalar forking for BPF_OR Daniel Wade
2026-03-14  2:15 ` [PATCH bpf v4 1/2] bpf: Fix unsound scalar forking in maybe_fork_scalars() " Daniel Wade
2026-03-14  2:15 ` [PATCH bpf v4 2/2] selftests/bpf: Add tests for maybe_fork_scalars() OR vs AND handling Daniel Wade
2026-03-21 20:20 ` [PATCH bpf v4 0/2] bpf: Fix unsound scalar forking for BPF_OR patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.