bpf: fix precision backtracking instruction iteration
Status from this message: Queued for 6.6, thanks.
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/10 | bpf: support non-r10 register spill/fill to/from stack in precision trackinginclude/ kernel/ tools/ +1 more | +169 | 0 replies | |
| 2/10 | selftests/bpf: add stack access precision testtools/ | +59 | 0 replies | |
| 3/10 | bpf: preserve STACK_ZERO slots on partial reg spillskernel/ | +23 | 0 replies | |
| 4/10 | selftests/bpf: validate STACK_ZERO is preserved on subreg spilltools/ | +40 | 0 replies | |
| 5/10 | bpf: preserve constant zero when doing partial register restorekernel/ | +21 | 0 replies | |
| 6/10 | selftests/bpf: validate zero preservation for sub-slot loadstools/ | +71 | 0 replies | |
| 7/10 | bpf: track aligned STACK_ZERO cases as imprecise spilled registerskernel/ | +7 | 0 replies | |
| 8/10 | selftests/bpf: validate precision logic in partial_stack_load_preserves_zerostools/ | +16 | 0 replies | |
| 9/10 | bpf: handle fake register spill to stack with BPF_ST_MEM instructionkernel/ | +0 | 0 replies | |
| 10/10 | selftests/bpf: validate fake register spill/fill precision backtracking logictools/ | +154 | 0 replies |
Reviews trailers per patch
All 10 patches have a Reviewed-by or Acked-by.
| Patch | Eduard Zingerman | Shung-Hsi Yu | Daniel Borkmann | Levi Zim |
|---|---|---|---|---|
| Series | T-b | |||
| 1/10 | A-b | A-b | A-b | |
| 2/10 | A-b | A-b | A-b | |
| 3/10 | A-b | A-b | A-b | |
| 4/10 | A-b | A-b | A-b | |
| 5/10 | A-b | A-b | A-b | |
| 6/10 | A-b | A-b | ||
| 7/10 | A-b | A-b | A-b | |
| 8/10 | A-b | A-b | A-b | |
| 9/10 | A-b | A-b | A-b | |
| 10/10 | A-b | A-b | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.
Cover letter [PATCH 6.6.y 00/10] bpf: fix precision backtracking instruction iteration
The first patch in this patchset was already backported before, as commit ecc2aeeaa08a, to address CVE-2023-52920 [1]. That backport was however later reverted in commit 199f04528737 because it reduced the efficiency of the BPF verifier, to the point that it rejected some previously-accepted programs.
This patchset backports commit 41f6f64e6999 ("bpf: support non-r10 register spill/fill to/from stack in precision tracking") again, but this time with the subsequent commits that improved the efficiency of the verifier. In addition, the last two commits fix and test a regression that was later found in commit 41f6f64e6999.
It took us a while with Shung-Hsi to come back to this because we felt we didn't have enough test coverage to backport this. That changed with the stable BPF CI Shung-Hsi built for v6.6, which successfully validated this patchset [2]. In addition, I tested the impact of this patchset on the verifier's efficiency with Cilium's BPF programs [3]:
it significantly improves, reducing the number of instructions the verifier has to analyze by up to 87% in some cases!
1: https://lore.kernel.org/linux-cve-announce/2024110518-CVE-2023-52920-17f6@gregkh/
2: https://github.com/pchaigno/stable-bpf-ci/actions/runs/25671397661/job/75357317078
3: https://pchaigno.github.io/test-verifier-complexity.html
Andrii Nakryiko (10):
bpf: support non-r10 register spill/fill to/from stack in precision
tracking
selftests/bpf: add stack access precision test
bpf: preserve STACK_ZERO slots on partial reg spills selftests/bpf: validate STACK_ZERO is preserved on subreg spill
bpf: preserve constant zero when doing partial register restore selftests/bpf: validate zero preservation for sub-slot loads
bpf: track aligned STACK_ZERO cases as imprecise spilled registers selftests/bpf: validate precision logic in
partial_stack_load_preserves_zeros
bpf: handle fake register spill to stack with BPF_ST_MEM instruction selftests/bpf: validate fake register spill/fill precision
backtracking logic
include/linux/bpf_verifier.h | 31 +- kernel/bpf/verifier.c | 233 +++++++++------ .../selftests/bpf/progs/verifier_spill_fill.c | 281 ++++++++++++++++++ .../bpf/progs/verifier_subprog_precision.c | 87 +++++- .../testing/selftests/bpf/verifier/precise.c | 38 ++- 5 files changed, 557 insertions(+), 113 deletions(-)
Signature · 1 line
2.43.0