selftests/bpf: Add testcases for BPF_ADD and BPF_SUB
authorHarishankar Vishwanathan <harishankar.vishwanathan@gmail.com>
Mon, 23 Jun 2025 04:03:57 +0000 (00:03 -0400)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 25 Jun 2025 01:48:34 +0000 (18:48 -0700)
commite1d794541b3f17c37f66d4134ee7c044fac4dc87
treeafb517bfdca6a0e299b11bfa2eb6a7b9b16fc17a
parent7a998a73162773d5d8dca4c9f46af26a499d8f19
selftests/bpf: Add testcases for BPF_ADD and BPF_SUB

The previous commit improves the precision in scalar(32)_min_max_add,
and scalar(32)_min_max_sub. The improvement in precision occurs in cases
when all outcomes overflow or underflow, respectively.

This commit adds selftests that exercise those cases.

This commit also adds selftests for cases where the output register
state bounds for u(32)_min/u(32)_max are conservatively set to unbounded
(when there is partial overflow or underflow).

Signed-off-by: Harishankar Vishwanathan <harishankar.vishwanathan@gmail.com>
Co-developed-by: Matan Shachnai <m.shachnai@rutgers.edu>
Signed-off-by: Matan Shachnai <m.shachnai@rutgers.edu>
Suggested-by: Eduard Zingerman <eddyz87@gmail.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20250623040359.343235-3-harishankar.vishwanathan@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/verifier_bounds.c