From: Alexei Starovoitov Date: Wed, 21 Jan 2026 00:41:54 +0000 (-0800) Subject: Merge branch 'bpf-add-range-tracking-for-bpf_div-and-bpf_mod' X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=900dbb6db68b6900b969421b42f64d9d3439d941;p=thirdparty%2Flinux.git Merge branch 'bpf-add-range-tracking-for-bpf_div-and-bpf_mod' Yazhou Tang says: ==================== bpf: Add range tracking for BPF_DIV and BPF_MOD From: Yazhou Tang Add range tracking (interval analysis) for BPF_DIV and BPF_MOD when divisor is constant. Please see commit log of 1/2 for more details. Changes v4 => v5: 1. Rename helper functions `__reset_reg(32|64)_and_tnum` to `reset_reg(32|64)_and_tnum`. (Alexei) 2. Replace plain C division with `div64_u64` and `div64_s64` for 64-bit operations, ensuring compatibility with 32-bit architectures. (Alexei & kernel test robot) 3. Fixup an indent typo in selftest file `verifier_div_mod_bounds.c`. v4: https://lore.kernel.org/bpf/20260116103246.2477635-1-tangyazhou@zju.edu.cn/ Changes v3 => v4: 1. Remove verbose helper functions for "division by zero" handling. (Alexei) 2. Put all "reset" logic in one place for clarity, and add 2 helper function `__reset_reg64_and_tnum` and `__reset_reg32_and_tnum` to reduce code duplication. (Alexei) 3. Update all multi-line comments to follow the standard kernel style. (Alexei) 4. Add new test cases to cover strictly positive and strictly negative divisor scenarios in SDIV and SMOD analysis. (Alexei) 5. Fixup a typo in SDIV analysis functions. v3: https://lore.kernel.org/bpf/20260113103552.3435695-1-tangyazhou@zju.edu.cn/ Changes v2 => v3: 1. Fixup a bug in `adjust_scalar_min_max_vals` function that lead to incorrect range results. (Syzbot) 2. Remove tnum analysis logic. (Alexei) 3. Only handle "constant divisor" case. (Alexei) 4. Add BPF_MOD range analysis logic. 5. Update selftests accordingly. 6. Add detailed code comments and improve commit messages. (Yonghong) v2: https://lore.kernel.org/bpf/20251223091120.2413435-1-tangyazhou@zju.edu.cn/ Changes v1 => v2: 1. Fixed 2 bugs in sdiv32 analysis logic and corrected the associated selftest cases. (AI reviewer) 2. Renamed `tnum_bottom` to `tnum_empty` for better clarity, and updated commit message to explain its role in signed BPF_DIV analysis. v1: https://lore.kernel.org/bpf/tencent_717092CD734D050CCD93401CA624BB3C8307@qq.com/ https://lore.kernel.org/bpf/tencent_7C98FAECA40C98489ACF4515CE346F031509@qq.com/ ==================== Link: https://patch.msgid.link/20260119085458.182221-1-tangyazhou@zju.edu.cn Signed-off-by: Alexei Starovoitov --- 900dbb6db68b6900b969421b42f64d9d3439d941