BPF List
 help / color / mirror / Atom feed
* [bpf-next v2 0/2] bpf: Preserve stack frame number for commuted arithmetic
@ 2026-07-21  9:39 Yiyang Chen
  2026-07-21  9:39 ` [PATCH 1/2] " Yiyang Chen
  2026-07-21  9:39 ` [PATCH 2/2] selftests/bpf: Cover stack frame number after scalar plus fp Yiyang Chen
  0 siblings, 2 replies; 9+ messages in thread
From: Yiyang Chen @ 2026-07-21  9:39 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi
  Cc: Yiyang Chen, John Fastabend, Martin KaFai Lau, Song Liu,
	Yonghong Song, Jiri Olsa, Shuah Khan, Emil Tsalapatis, bpf,
	linux-kselftest, linux-kernel

The verifier uses reg->frameno to distinguish stack pointers that have
the same offset but refer to different call frames. The scalar += pointer
path copies pointer type and id to the destination register, but it also
needs to preserve pointer provenance fields such as the stack frame
number.

Preserve the full pointer register state for commuted stack pointer
arithmetic and add a verifier regression test where a callee derives its
frame pointer through scalar += fp before overwriting and reloading the
same stack slot.

Changes in v2:
- Preserve the full pointer register state instead of copying only
  selected fields, as suggested by Eduard.
- Use a temporary scalar offset register for the commuted scalar += fp
  case, as suggested by Eduard.
- Add a Fixes tag to the verifier change.
- Drop CAP_SYS_ADMIN handling from the new verifier_basic_stack harness,
  as requested by Eduard.

Yiyang Chen (2):
  bpf: Preserve stack frame number for commuted arithmetic
  selftests/bpf: Cover stack frame number after scalar plus fp

 kernel/bpf/verifier.c                         | 14 +++++++-----
 .../selftests/bpf/prog_tests/verifier.c       |  2 -
 .../bpf/prog_tests/verifier_basic_stack.c     | 14 ++++++++
 .../bpf/progs/verifier_basic_stack.c          | 41 +++++++++++++++++++
 4 files changed, 64 insertions(+), 10 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/verifier_basic_stack.c


base-commit: 0bcca2a42cc50b7d64a95c08dffc6b93661a7ea2
--
2.34.1


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

end of thread, other threads:[~2026-07-22  8:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-21  9:39 [bpf-next v2 0/2] bpf: Preserve stack frame number for commuted arithmetic Yiyang Chen
2026-07-21  9:39 ` [PATCH 1/2] " Yiyang Chen
2026-07-21  9:48   ` sashiko-bot
2026-07-22  7:44     ` Shung-Hsi Yu
2026-07-22  0:12   ` Eduard Zingerman
2026-07-22  8:46     ` Shung-Hsi Yu
2026-07-21  9:39 ` [PATCH 2/2] selftests/bpf: Cover stack frame number after scalar plus fp Yiyang Chen
2026-07-21 10:29   ` bot+bpf-ci
2026-07-21 23:53     ` Eduard Zingerman

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