BPF List
 help / color / mirror / Atom feed
* [PATCH bpf 0/2] bpf: Fix stack argument precision propagation
@ 2026-10-27  6:13 Xu Yunxiang
  2026-10-27  6:13 ` [PATCH bpf 1/2] bpf: Propagate scalar precision through stack arguments Xu Yunxiang
  2026-10-27  6:13 ` [PATCH bpf 2/2] selftests/bpf: Exercise stack argument precision on state reuse Xu Yunxiang
  0 siblings, 2 replies; 4+ messages in thread
From: Xu Yunxiang @ 2026-10-27  6:13 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, Yonghong Song

This series fixes two omissions in scalar precision tracking for BPF
stack arguments.

State comparison already uses precision marks on outgoing argument slots,
but state reuse does not propagate their dependencies to the current
path's ancestors. Earlier checkpoints can therefore fail to distinguish
scalar argument values later used as memory offsets. The conservative
all-scalars-precise fallback also omits argument slots.

Patch 1 includes stack argument slots in state-reuse precision propagation
and in the conservative fallback, including slots owned by caller frames.
Patch 2 adds nine load-only tests covering the sixth and seventh arguments,
caller and nested frames, acceptance and rejection controls, and fallback
log checks. The tests construct instructions and BTF directly, so they do
not require compiler support for emitting stack arguments.

Built the kernel, modules and complete test_progs with BPF_STRICT_BUILD=1.
On x86-64 KVM, all nine new tests and 246 existing subtests passed, covering
verifier_precision, verifier_spill_fill, verifier_subprog_precision,
verifier_scalar_ids and iters. The unmodified base fails six of the new
tests as expected. Three existing compiler-dependent stack-argument groups
were skipped with Clang 20; all new tests ran.

AI assistance was used to prepare the patches, tests and descriptions.

Xu Yunxiang (2):
  bpf: Propagate scalar precision through stack arguments
  selftests/bpf: Exercise stack argument precision on state reuse

 kernel/bpf/backtrack.c                             |  11 +
 kernel/bpf/states.c                                |  14 +
 .../bpf/prog_tests/stack_arg_precision_reuse.c       | 300 +++++++++++++++++++++
 3 files changed, 325 insertions(+)

base-commit: 195a3519ff27bff5575e05b5086e38ee92715776


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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-27  6:13 [PATCH bpf 0/2] bpf: Fix stack argument precision propagation Xu Yunxiang
2026-10-27  6:13 ` [PATCH bpf 1/2] bpf: Propagate scalar precision through stack arguments Xu Yunxiang
2026-10-27  6:13 ` [PATCH bpf 2/2] selftests/bpf: Exercise stack argument precision on state reuse Xu Yunxiang
2026-10-27  6:27   ` sashiko-bot

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