mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] bpf: Preserve stack frame number for commuted stack arithmetic
@ 2026-07-20 16:37 Yiyang Chen
  2026-07-20 16:37 ` [PATCH bpf-next 1/2] bpf: Preserve stack frame number for commuted arithmetic Yiyang Chen
  2026-07-20 16:37 ` [PATCH bpf-next 2/2] selftests/bpf: Cover stack frame number after scalar plus fp Yiyang Chen
  0 siblings, 2 replies; 6+ messages in thread
From: Yiyang Chen @ 2026-07-20 16:37 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 frameno when the source pointer is PTR_TO_STACK.

Preserve the frame number 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.

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                         |  7 +++-
 .../selftests/bpf/prog_tests/verifier.c       |  2 -
 .../bpf/prog_tests/verifier_basic_stack.c     | 28 +++++++++++++
 .../bpf/progs/verifier_basic_stack.c          | 41 +++++++++++++++++++
 4 files changed, 74 insertions(+), 4 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/verifier_basic_stack.c


base-commit: cfce77b63375dac81d53f2f85593c548415206b7
-- 
2.34.1


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

end of thread, other threads:[~2026-07-21  7:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-20 16:37 [PATCH bpf-next 0/2] bpf: Preserve stack frame number for commuted stack arithmetic Yiyang Chen
2026-07-20 16:37 ` [PATCH bpf-next 1/2] bpf: Preserve stack frame number for commuted arithmetic Yiyang Chen
2026-07-20 18:47   ` Eduard Zingerman
2026-07-21  7:51     ` Yiyang Chen
2026-07-20 16:37 ` [PATCH bpf-next 2/2] selftests/bpf: Cover stack frame number after scalar plus fp Yiyang Chen
2026-07-20 17:18   ` Eduard Zingerman

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

all inboxes | Powered by JetHome®