Merge branch 'bpf-improve-64bits-bounds-refinement'
authorAlexei Starovoitov <ast@kernel.org>
Mon, 28 Jul 2025 17:02:13 +0000 (10:02 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 28 Jul 2025 17:02:13 +0000 (10:02 -0700)
commita9f8d8adcb0905cff282804a0ef8bdc231da0ad2
treed8b3b94a9e7170555fa0f22c3c74ba1272719f99
parent5345e64760d37524d38ddfa7471f42ec64b0f289
parent5dbb19b16ac498b0b7f3a8a85f9d25d6d8af397d
Merge branch 'bpf-improve-64bits-bounds-refinement'

Paul Chaignon says:

====================
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).

Link: https://syzkaller.appspot.com/bug?extid=c711ce17dd78e5d4fdcf
Link: https://github.com/bpfverif/agni
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.
====================

Link: https://patch.msgid.link/cover.1753695655.git.paul.chaignon@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>