From: kernel test robot <lkp@intel.com>
To: Yazhou Tang <yazhoutang@foxmail.com>, bpf@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev, ast@kernel.org,
daniel@iogearbox.net, john.fastabend@gmail.com,
andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com,
song@kernel.org, yonghong.song@linux.dev, kpsingh@kernel.org,
sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org,
tangyazhou518@outlook.com, shenghaoyuan0928@163.com,
ziye@zju.edu.cn
Subject: Re: [PATCH bpf-next 1/2] bpf: Add interval and tnum analysis for signed and unsigned BPF_DIV
Date: Tue, 23 Dec 2025 08:19:18 +0800 [thread overview]
Message-ID: <202512230859.IsGUdbZS-lkp@intel.com> (raw)
In-Reply-To: <tencent_7C98FAECA40C98489ACF4515CE346F031509@qq.com>
Hi Yazhou,
kernel test robot noticed the following build errors:
[auto build test ERROR on bpf-next/master]
url: https://github.com/intel-lab-lkp/linux/commits/Yazhou-Tang/selftests-bpf-Add-tests-for-BPF_DIV-analysis/20251221-174300
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/tencent_7C98FAECA40C98489ACF4515CE346F031509%40qq.com
patch subject: [PATCH bpf-next 1/2] bpf: Add interval and tnum analysis for signed and unsigned BPF_DIV
config: i386-randconfig-053-20251222 (https://download.01.org/0day-ci/archive/20251223/202512230859.IsGUdbZS-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251223/202512230859.IsGUdbZS-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512230859.IsGUdbZS-lkp@intel.com/
All errors (new ones prefixed by >>):
ld: kernel/bpf/verifier.o: in function `__bpf_sdiv':
>> kernel/bpf/verifier.c:15227:(.text+0xfcb2): undefined reference to `__divdi3'
>> ld: kernel/bpf/verifier.c:15227:(.text+0xfd37): undefined reference to `__divdi3'
ld: kernel/bpf/verifier.c:15227:(.text+0xfdae): undefined reference to `__divdi3'
ld: kernel/bpf/verifier.c:15227:(.text+0xfe0c): undefined reference to `__divdi3'
ld: kernel/bpf/verifier.c:15227:(.text+0xff7c): undefined reference to `__divdi3'
ld: kernel/bpf/verifier.o: in function `scalar_min_max_udiv':
>> kernel/bpf/verifier.c:15138:(.text+0x1b9bb): undefined reference to `__udivdi3'
>> ld: kernel/bpf/verifier.c:15139:(.text+0x1b9dc): undefined reference to `__udivdi3'
ld: kernel/bpf/tnum.o: in function `tnum_udiv':
>> kernel/bpf/tnum.c:227:(.text+0x1b3): undefined reference to `__udivdi3'
>> ld: kernel/bpf/tnum.c:219:(.text+0x28d): undefined reference to `__udivdi3'
ld: kernel/bpf/tnum.c:227:(.text+0xb05): undefined reference to `__udivdi3'
ld: kernel/bpf/tnum.o:kernel/bpf/tnum.c:219: more undefined references to `__udivdi3' follow
ld: kernel/bpf/tnum.o: in function `tnum_sdiv':
>> kernel/bpf/tnum.c:300:(.text+0x131d): undefined reference to `__divdi3'
vim +15227 kernel/bpf/verifier.c
15118
15119 static void scalar_min_max_udiv(struct bpf_reg_state *dst_reg,
15120 struct bpf_reg_state *src_reg)
15121 {
15122 u64 *dst_umin = &dst_reg->umin_value;
15123 u64 *dst_umax = &dst_reg->umax_value;
15124 u64 umin_val = src_reg->umin_value;
15125 u64 umax_val = src_reg->umax_value;
15126
15127 if (umin_val == 0) {
15128 /* BPF div specification: x / 0 = 0
15129 * 1. If umin_val == umax_val == 0, i.e. divisor is certainly 0,
15130 * then the result must be 0, [a,b] / [0,0] = [0,0].
15131 * 2. If umin_val == 0 && umax_val != 0, then dst_umin = x / 0 = 0,
15132 * dst_umax = dst_umax / 1, remains unchanged, [a,b] / [0,x] = [0,b].
15133 */
15134 *dst_umin = 0;
15135 if (umax_val == 0)
15136 *dst_umax = 0;
15137 } else {
15138 *dst_umin = *dst_umin / umax_val;
15139 *dst_umax = *dst_umax / umin_val;
15140 }
15141
15142 /* Reset signed interval to TOP. */
15143 dst_reg->smin_value = S64_MIN;
15144 dst_reg->smax_value = S64_MAX;
15145 }
15146
15147 static s32 __bpf_sdiv32(s32 a, s32 b)
15148 {
15149 /* BPF div specification: x / 0 = 0 */
15150 if (unlikely(b == 0))
15151 return 0;
15152 /* BPF mod specification: S32_MIN / -1 = S32_MIN */
15153 if (unlikely(a == S32_MIN && b == -1))
15154 return S32_MIN;
15155 return a / b;
15156 }
15157
15158 /* The divisor interval does not cross 0,
15159 * i.e. src_min and src_max have same sign.
15160 */
15161 static void __sdiv32_range(s32 dst_min, s32 dst_max, s32 src_min, s32 src_max,
15162 s32 *res_min, s32 *res_max)
15163 {
15164 s32 tmp_res[4] = {
15165 __bpf_sdiv32(dst_min, src_min),
15166 __bpf_sdiv32(dst_min, src_max),
15167 __bpf_sdiv32(dst_max, src_min),
15168 __bpf_sdiv32(dst_max, src_max)
15169 };
15170
15171 *res_min = min_array(tmp_res, 4);
15172 *res_max = max_array(tmp_res, 4);
15173 }
15174
15175 static void scalar32_min_max_sdiv(struct bpf_reg_state *dst_reg,
15176 struct bpf_reg_state *src_reg)
15177 {
15178 u32 *dst_smin = &dst_reg->s32_min_value;
15179 u32 *dst_smax = &dst_reg->s32_max_value;
15180 u32 smin_val = src_reg->s32_min_value;
15181 u32 smax_val = src_reg->s32_max_value;
15182 s32 res_min, res_max, tmp_min, tmp_max;
15183
15184 if (smin_val <= 0 && smax_val >= 0) {
15185 /* BPF div specification: x / 0 = 0
15186 * Set initial result to 0, as 0 is in divisor interval.
15187 */
15188 res_min = 0;
15189 res_max = 0;
15190 /* negative divisor interval: [a_min,a_max] / [b_min,-1] */
15191 if (smin_val < 0) {
15192 __sdiv32_range(*dst_smin, *dst_smax, smin_val, -1,
15193 &tmp_min, &tmp_max);
15194 __scalar32_min_max_join(&res_min, &res_max, tmp_min, tmp_max);
15195 }
15196 /* positive divisor interval: [a_min,a_max] / [1,b_max] */
15197 if (smax_val > 0) {
15198 __sdiv32_range(*dst_smin, *dst_smax, 1, smax_val,
15199 &tmp_min, &tmp_max);
15200 __scalar32_min_max_join(&res_min, &res_max, tmp_min, tmp_max);
15201 }
15202 } else {
15203 __sdiv32_range(*dst_smin, *dst_smax, smin_val, smax_val,
15204 &res_min, &res_max);
15205 }
15206
15207 /* BPF mod specification: S32_MIN / -1 = S32_MIN */
15208 if (*dst_smin == S32_MIN && smin_val <= -1 && smax_val >= -1)
15209 res_min = S32_MIN;
15210
15211 *dst_smin = res_min;
15212 *dst_smax = res_max;
15213
15214 /* Reset unsigned interval to TOP. */
15215 dst_reg->u32_min_value = 0;
15216 dst_reg->u32_max_value = U32_MAX;
15217 }
15218
15219 static s64 __bpf_sdiv(s64 a, s64 b)
15220 {
15221 /* BPF div specification: x / 0 = 0 */
15222 if (unlikely(b == 0))
15223 return 0;
15224 /* BPF div specification: S64_MIN / -1 = S64_MIN */
15225 if (unlikely(a == S64_MIN && b == -1))
15226 return S64_MIN;
15227 return a / b;
15228 }
15229
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2025-12-23 0:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20251221093955.109312-1-yazhoutang@foxmail.com>
2025-12-21 9:39 ` [PATCH bpf-next 1/2] bpf: Add interval and tnum analysis for signed and unsigned BPF_DIV Yazhou Tang
2025-12-21 10:07 ` bot+bpf-ci
2025-12-22 23:00 ` kernel test robot
2025-12-23 0:19 ` kernel test robot [this message]
2025-12-23 20:14 ` kernel test robot
2025-12-21 9:39 ` [PATCH bpf-next 2/2] selftests/bpf: Add tests for BPF_DIV analysis Yazhou Tang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202512230859.IsGUdbZS-lkp@intel.com \
--to=lkp@intel.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=martin.lau@linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=sdf@fomichev.me \
--cc=shenghaoyuan0928@163.com \
--cc=song@kernel.org \
--cc=tangyazhou518@outlook.com \
--cc=yazhoutang@foxmail.com \
--cc=yonghong.song@linux.dev \
--cc=ziye@zju.edu.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.