All of lore.kernel.org
 help / color / mirror / Atom feed
* [bpf-next:master 35/51] kernel/bpf/precision.c:1418 bpf_undo_precision() error: buffer overflow 'partition_by' 8 <= 8
@ 2026-11-21 16:42 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-11-21 16:42 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Alexei Starovoitov <ast@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
head:   9867c61abbd44f7053a871566b3d982f62c6d8dc
commit: ecb43124db3947b1d632e2fe651d994a399186ef [35/51] bpf: Partition the states after an error
:::::: branch date: 12 hours ago
:::::: commit date: 12 hours ago
config: parisc-randconfig-2200-20261121 (https://download.01.org/0day-ci/archive/20261121/20261121173744.q01c3spZ-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 16.2.0
smatch: v0.5.0-9187-g5189e3fb

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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/20261121173744.q01c3spZ-lkp@intel.com/

smatch warnings:
kernel/bpf/precision.c:1418 bpf_undo_precision() error: buffer overflow 'partition_by' 8 <= 8

vim +/partition_by +1418 kernel/bpf/precision.c

ecb43124db3947 Alexei Starovoitov 2026-11-20  1380  
ecb43124db3947 Alexei Starovoitov 2026-11-20  1381  /* The pass is over its budget. Returns true if another partition replaces the last one. */
ecb43124db3947 Alexei Starovoitov 2026-11-20  1382  bool bpf_undo_precision(struct bpf_verifier_env *env)
ecb43124db3947 Alexei Starovoitov 2026-11-20  1383  {
ecb43124db3947 Alexei Starovoitov 2026-11-20  1384  	struct bpf_precision *prec = env->precision;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1385  	bool over_budget = false, again = false;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1386  	struct bpf_loop *loop;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1387  	u32 i;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1388  
ecb43124db3947 Alexei Starovoitov 2026-11-20  1389  	prec->this_pass.over_budget = env->over_limit;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1390  	prec->this_pass.calls_joined = env->calls_joined;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1391  	if (!env->over_limit || env->cost > env->max_cost)
ecb43124db3947 Alexei Starovoitov 2026-11-20  1392  		return false;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1393  	if (prec->partitioned_by <= BIT(PARTITION_ADD_DEPS) ||
ecb43124db3947 Alexei Starovoitov 2026-11-20  1394  	    (env->err && (prec->last_pass.over_budget || partition_helped(env)))) {
ecb43124db3947 Alexei Starovoitov 2026-11-20  1395  		env->over_limit = !env->err;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1396  		return false;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1397  	}
ecb43124db3947 Alexei Starovoitov 2026-11-20  1398  	env->over_limit = false;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1399  	memcpy(prec->data_deps, prec->undo, 5 * prec->words * sizeof(long));
ecb43124db3947 Alexei Starovoitov 2026-11-20  1400  	for (i = 0; i < prec->loop_cnt; i++)
ecb43124db3947 Alexei Starovoitov 2026-11-20  1401  		over_budget |= prec->loops[i]->partitioned &&
ecb43124db3947 Alexei Starovoitov 2026-11-20  1402  			       !bpf_loop_has_budget(prec->loops[i]);
ecb43124db3947 Alexei Starovoitov 2026-11-20  1403  	for (i = 0; i < prec->loop_cnt; i++) {
ecb43124db3947 Alexei Starovoitov 2026-11-20  1404  		loop = prec->loops[i];
ecb43124db3947 Alexei Starovoitov 2026-11-20  1405  		if (loop->partitioned)
ecb43124db3947 Alexei Starovoitov 2026-11-20  1406  			undo_loop(prec, loop);
ecb43124db3947 Alexei Starovoitov 2026-11-20  1407  		/* if the old budget was enough, the pass possibly did not get to the loop */
ecb43124db3947 Alexei Starovoitov 2026-11-20  1408  		if (loop->partitioned && over_budget && bpf_loop_has_budget(loop))
ecb43124db3947 Alexei Starovoitov 2026-11-20  1409  			loop->tried &= ~prec->partitioned_by;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1410  		/* peeled_apart did not help. The partition can fit without it. */
ecb43124db3947 Alexei Starovoitov 2026-11-20  1411  		if (loop->peeled_apart && !loop->kept.peeled_apart) {
ecb43124db3947 Alexei Starovoitov 2026-11-20  1412  			loop->peeled_apart = false;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1413  			loop->tried |= BIT(PARTITION_PEELED_APART) |
ecb43124db3947 Alexei Starovoitov 2026-11-20  1414  				       BIT(PARTITION_TOO_COSTLY);
ecb43124db3947 Alexei Starovoitov 2026-11-20  1415  			loop->changed = again = true;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1416  		}
ecb43124db3947 Alexei Starovoitov 2026-11-20  1417  	}
ecb43124db3947 Alexei Starovoitov 2026-11-20 @1418  	if (partition_by[__ffs(prec->partitioned_by)] != partition_suspect_loops && !again)
ecb43124db3947 Alexei Starovoitov 2026-11-20  1419  		prec->too_costly |= prec->partitioned_by;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1420  	return partition_next(env) > 0;
ecb43124db3947 Alexei Starovoitov 2026-11-20  1421  }
ecb43124db3947 Alexei Starovoitov 2026-11-20  1422  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-21 16:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-21 16:42 [bpf-next:master 35/51] kernel/bpf/precision.c:1418 bpf_undo_precision() error: buffer overflow 'partition_by' 8 <= 8 kernel test robot

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.