Skip to content

bpf: Improve 64bits bounds refinement

Paul Chaignon bpf 4 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest5 patches 0 repliesApplied 5/5
  2. v35 patches 2 repliesSuperseded
  3. v24 patches 7 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches9 repliesSuperseded

Changes in v4 from the cover letter

- Fixed outdated test comment, noticed by Eduard.
- Rebased.

Patches in v4 All 5 applied

#Subject and filesSizeRepliesApplied
1/5bpf: Improve bounds when s64 crosses sign boundarykernel/bpf/verifier.c+52 -00 repliesApplied
2/5selftests/bpf: Update reg_bound range refinement logictools/testing/selftests/bpf/prog_tests/reg_bounds.c+14 -00 repliesApplied
3/5selftests/bpf: Test cross-sign 64bits range refinementtools/testing/selftests/bpf/progs/verifier_bounds.c+118 -00 repliesApplied
4/5selftests/bpf: Test invariants on JSLT crossing signtools/testing/selftests/bpf/progs/verifier_bounds.c+1 -10 repliesApplied
5/5bpf: Add third round of bounds deductionkernel/bpf/verifier.c tools/testing/selftests/bpf/progs/verifier_bounds.c+2 -10 repliesApplied

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchEduard ZingermanShung-Hsi Yu
1/5A-b A-b
2/5A-b
3/5A-b
4/5A-b
5/5A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH bpf-next v4 0/5] bpf: Improve 64bits bounds refinement

This patchset improves the 64bits bounds refinement when the s64 ranges crosses the sign boundary. The first patch explains the small addition to __reg64_deduce_bounds. The last one explains why we need a third round of __reg_deduce_bounds. The third patch adds a selftest with a more complete example of the impact on verification. The second and fourth patches update the existing selftests to take the new refinement into account.

This patchset should reduce the number of kernel warnings hit by syzkaller due to invariant violations [1]. It was also tested with Agni [2] (and Cilium's CI for good measure).

Changes in v4:
- Fixed outdated test comment, noticed by Eduard.
- Rebased.
Changes in v3:
- Added a 5th patch to call __reg_deduce_bounds a third time in reg_bounds_sync following tests from Eduard.
- Fixed broken indentations in the first patch.
Changes in v2 (all on Eduard's suggestions):
- Added two tests to ensure we cover all cases of u64/s64 overlap.
- Improved tests to check deduced ranges with __msg.
- Improved code comments.

Paul Chaignon (5):
bpf: Improve bounds when s64 crosses sign boundary selftests/bpf: Update reg_bound range refinement logic selftests/bpf: Test cross-sign 64bits range refinement selftests/bpf: Test invariants on JSLT crossing sign
bpf: Add third round of bounds deduction

 kernel/bpf/verifier.c                         |  53 ++++++++
 .../selftests/bpf/prog_tests/reg_bounds.c     |  14 ++
 .../selftests/bpf/progs/verifier_bounds.c     | 120 +++++++++++++++++-
 3 files changed, 186 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0