RFC Improve signed ranges reasoning for BPF_AND
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 RFC Latest3 patches 3 repliesIn review
- v1 RFC1 patch 1 replySuperseded
Changes in v2 from the cover letter
- address comments
- add code comment in scalar*_min_max_and() to better explaining the reasoning (Eduard, Alexei)
- point out unsigned range are still propagated to signed range later in __reg_deduce_bounds() (Edward)
- point out the fls(~v) special case in negative_bit_floor() (Edward)
- revert workaround added in 229d6db14942
- add additional tests
- v1 can be found at both
- https://lore.kernel.org/bpf/[email protected]/
- https://lore.kernel.org/bpf/[email protected]/
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | bpf, verifier: improve signed ranges reasoning for BPF_ANDkernel/ tools/ | +85 | 0 replies | |
| 2/3 | selftests/bpf: bring back verifier tests for bpf lsmtools/ | +16 | 0 replies | |
| 3/3 | selftests/bpf: add more verifier tests for signed range deduction of BPF_ANDtools/ | +56 | 3 replies |
Reviews trailers per patch
1 of 3 patches has a Reviewed-by or Acked-by.
| Patch | Eduard Zingerman | Edward Cree | Harishankar Vishwanathan |
|---|---|---|---|
| 1/3 | A-b | R-b | T-b |
| 2/3 | |||
| 3/3 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [RFC bpf-next v2 0/3] Improve signed ranges reasoning for BPF_AND
RFC because the selftests in the 3rd patch is failing and I couldn't figure out what's going on, sending out for suggestion.
This is a follow up of Xu Kuohai's "Add BPF LSM return value range check, BPF part" series[1], where the 5th patch "improve signed ranges inference for BPF_AND" was omitting because further changes were required. This series brough back that patch (with modifications as requested), removed workaround, and bring back 'test 3'[2] from Xu Kuohai that was also dropped.
Patch 1 add reasoning of signed ranges directly from previous signed ranges during BPF_AND to the BPF verfier, which allowed better tracking of signed range for situation like [-1, 0] & -13. See the patch for complete detail.
Patch 2 and 3 are corresponding tests. Patch 2 brings back an omitted test[2] from Xu Kuohai. Patch 3 add more specific test in verifier_and.c.
1: https://lore.kernel.org/bpf/[email protected]/
2: https://lore.kernel.org/bpf/[email protected]/
Changes since v1:
- address comments
- add code comment in scalar*_min_max_and() to better explaining the reasoning (Eduard, Alexei)
- point out unsigned range are still propagated to signed range later in __reg_deduce_bounds() (Edward)
- point out the fls(~v) special case in negative_bit_floor() (Edward)
- revert workaround added in 229d6db14942
- add additional tests
- v1 can be found at both
- https://lore.kernel.org/bpf/[email protected]/
- https://lore.kernel.org/bpf/[email protected]/
Shung-Hsi Yu (3):
bpf, verifier: improve signed ranges inference for BPF_AND selftests/bpf: bring back verifier tests for bpf lsm selftests/bpf: add more verifier tests for signed range deduction of
BPF_AND
kernel/bpf/verifier.c | 105 ++++++++++++++---- .../bpf/progs/test_libbpf_get_fd_by_id_opts.c | 1 - .../selftests/bpf/progs/verifier_and.c | 56 ++++++++++ .../selftests/bpf/progs/verifier_lsm.c | 16 +++ 4 files changed, 157 insertions(+), 21 deletions(-)
Signature · 1 line
2.47.0