BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/2] bpf: Reject mixed arena and ordinary atomic paths
@ 2026-08-16 10:56 Yiyang Chen
  2026-08-16 10:56 ` [PATCH bpf-next v2 1/2] bpf: Check pointer type for all atomic RMW paths Yiyang Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Yiyang Chen @ 2026-08-16 10:56 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, John Fastabend,
	Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi,
	Martin KaFai Lau, Song Liu, Yonghong Song, Jiri Olsa,
	Emil Tsalapatis, Ihor Solodrai, Shuah Khan
  Cc: bpf, linux-kernel, linux-kselftest, Yiyang Chen

Atomic RMW instructions use a single aux pointer type to select their final
instruction encoding. The verifier currently records that type only for
PTR_TO_ARENA, allowing a second path with an ordinary pointer to reach the
same instruction before fixups rewrite it to BPF_PROBE_ATOMIC.

Patch 1 records the destination type for every atomic RMW path so the existing
pointer mismatch check rejects incompatible uses of one instruction.

Patch 2 adds a verifier regression test with PTR_TO_ARENA and
PTR_TO_STACK paths converging on one atomic add.

Yiyang Chen (2):
  bpf: Check pointer type for all atomic RMW paths
  selftests/bpf: Cover mixed arena and stack atomics

Signed-off-by: Yiyang Chen <chenyy23@mails.tsinghua.edu.cn>
---
Changes in v2:
- Remove the arena global and extra map from the selftest; reuse the existing
  arena map and a stack destination.
- Construct the arena pointer from a scalar and encode the cast with
  __imm_insn.
- Rebase onto bpf-next commit c93cbdb13f99.
- Link to v1: https://lore.kernel.org/r/20260813-bpf-next-038-mixed-atomic-v1-v1-0-e79aadb46a8a@mails.tsinghua.edu.cn

---
Yiyang Chen (2):
      bpf: Check pointer type for all atomic RMW paths
      selftests/bpf: Cover mixed arena and stack atomics

 kernel/bpf/verifier.c                              |  8 ++---
 tools/testing/selftests/bpf/progs/verifier_arena.c | 39 ++++++++++++++++++++++
 2 files changed, 42 insertions(+), 5 deletions(-)
---
base-commit: c93cbdb13f995f87b5356329b3fe551c80bb482d
-- 
2.43.0


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

end of thread, other threads:[~2026-08-17  6:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-16 10:56 [PATCH bpf-next v2 0/2] bpf: Reject mixed arena and ordinary atomic paths Yiyang Chen
2026-08-16 10:56 ` [PATCH bpf-next v2 1/2] bpf: Check pointer type for all atomic RMW paths Yiyang Chen
2026-08-16 10:56 ` [PATCH bpf-next v2 2/2] selftests/bpf: Cover mixed arena and stack atomics Yiyang Chen
2026-08-16 11:43   ` bot+bpf-ci
2026-08-16 23:17   ` Eduard Zingerman
2026-08-16 23:36     ` Eduard Zingerman
2026-08-16 23:56       ` Eduard Zingerman
2026-08-17  6:10 ` [PATCH bpf-next v2 0/2] bpf: Reject mixed arena and ordinary atomic paths patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox