linux-next: manual merge of the bpf-next tree with the origin tree

From
Mark Brown <broonie@kernel.org>
Date
2026-11-12 14:19:24
Also in
bpf, linux-next, lkml
Hi all,

Today's linux-next merge of the bpf-next tree got a conflict in:

  kernel/bpf/scev.c

between commit:

  0af298e62e5cf ("treewide: refresh kmalloc_obj() conversions")

from the origin tree and commits:

  e2f3d29e88d08 ("bpf: Refine registers linked by scalar evolution at conditional jumps")
  aba76dc75e35f ("bpf: Construct scalar evolution expressions without allocations")
  cfef7bfa2c2a1 ("bpf: Give SSA names to the values that scalar evolution does not track")

from the bpf-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

diff --cc kernel/bpf/cfg.c
index 1b04538351a1f,bbcf42eae9d92..0000000000000
--- a/kernel/bpf/cfg.c
+++ b/kernel/bpf/cfg.c
diff --cc kernel/bpf/scev.c
index db123ef1f0718,b413998d9cf93..0000000000000
--- a/kernel/bpf/scev.c
+++ b/kernel/bpf/scev.c
@@@ -1260,23 -2430,13 +2430,13 @@@ static int compute_scev_for_loop(struc
  	u32 r;
  
  	if (log_level2)
- 		bpf_log(&env->log, "Computing SCEV for loop at %d:\n", cur_header);
+ 		bpf_log(&env->log, "Computing SCEV for %s at %d:\n",
+ 			cur_loop ? "loop" : "subprog", first);
  
- 	/*
- 	 * For irreducible loops, and for loops nesting a loop with a truncated
- 	 * exit list, just assume that everything is clobbered for now.
- 	 */
- 	if (!can_compute_loop_scev(cur_loop)) {
- 		header_env = get_loop_env(scev, cur_header, cur_header);
- 		if (!header_env)
- 			return -ENOMEM;
- 		/* The freshly allocated environment has all expressions unknown. */
- 		bitmap_fill(cur_loop->store_base_regs, REGS_NUM);
- 		header_env->empty = false;
+ 	if (!cur_loop && !can_compute_subprog_scev(env, sub))
  		return 0;
- 	}
  
 -	cur_env = kzalloc(sizeof(*cur_env), GFP_KERNEL_ACCOUNT);
 +	cur_env = kzalloc_obj(*cur_env, GFP_KERNEL_ACCOUNT);
  	if (!cur_env)
  		goto nomem;
  	if (log_level2) {
@@@ -1724,25 -3142,27 +3142,29 @@@ void bpf_free_scev(struct bpf_verifier_
  int bpf_init_scev(struct bpf_verifier_env *env)
  {
  	struct scev *scev;
+ 	u32 r;
  
 -	scev = kzalloc(sizeof(struct scev), GFP_KERNEL_ACCOUNT);
 +	scev = kzalloc_obj(struct scev, GFP_KERNEL_ACCOUNT);
  	if (!scev)
  		return -ENOMEM;
  	env->scev = scev;
  	bpf_mark_reg_known_scalar(&scev->zero_reg, 0);
- 	bpf_mark_reg_unknown_imprecise(&scev->unknown_reg);
- 	/* A power of two for hash & (exprs_ht_cnt - 1)` indexing. */
- 	scev->exprs_ht_cnt = roundup_pow_of_two(max(256U, DIV_ROUND_UP(env->prog->len, 4)));
- 	scev->exprs_ht = kvzalloc_objs(*scev->exprs_ht, scev->exprs_ht_cnt,
- 				       GFP_KERNEL_ACCOUNT);
- 	if (!scev->exprs_ht)
- 		goto nomem;
- 	if (expr0(scev, UNKNOWN) < 0 || expr0(scev, OPAQUE)  < 0)
+ 	bpf_mark_reg_unknown(&scev->unknown_reg);
+ 	setup_initial_loop_env(&scev->identity_env);
+ 	if (grow_exprs(scev, roundup_pow_of_two(REG_EXPR_ID(REGS_NUM))))
  		goto nomem;
+ 	scev->exprs[UNKNOWN_EXPR_ID] = (struct expr){ .op = UNKNOWN };
+ 	scev->exprs[OPAQUE_EXPR_ID] = (struct expr){ .op = OPAQUE };
+ 	for (r = 0; r < REGS_NUM; r++)
+ 		scev->exprs[REG_EXPR_ID(r)] = (struct expr){ .op = REG, .is_vn = true,
+ 							     .params = { r, 0 } };
+ 	for (r = 0; r < REG_EXPR_ID(REGS_NUM); r++)
+ 		set_expr_base(scev, &scev->exprs[r], r);
+ 	scev->exprs_cnt = REG_EXPR_ID(REGS_NUM);
 -	scev->envs = kvcalloc(env->prog->len, sizeof(*scev->envs), GFP_KERNEL_ACCOUNT);
 -	scev->discovered = kvcalloc(env->prog->len, sizeof(*scev->discovered), GFP_KERNEL_ACCOUNT);
 +	scev->envs = kvzalloc_objs(*scev->envs, env->prog->len,
 +				   GFP_KERNEL_ACCOUNT);
 +	scev->discovered = kvzalloc_objs(*scev->discovered, env->prog->len,
 +					 GFP_KERNEL_ACCOUNT);
  	if (!scev->envs || !scev->discovered)
  		goto nomem;
  	/*

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help