🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Mark Brown Fri, 27 Nov 2026 15:55
linux-next: manual merge of the bpf-next tree with the bpf tree
#23623
Author: Mark Brown
Date: Fri, 27 Nov 2026 15:55
226 lines
15410 bytes
--/PoCzhzasBjJC5sz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi all,

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

  kernel/bpf/verifier.c

between commit:

  02d3452bdd80c ("bpf: Set the run context for async callbacks")

=66rom the bpf tree and commit:

  d83c595d9480e ("bpf: Put a barrier where no mask fits")

=66rom 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/verifier.c
index 85fec1f389277,b5dda95c286f7..0000000000000
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@@ -11493,13 -11472,9 +11477,15 @@@ static int push_callback_call(struct bp
  	if (bpf_is_async_callback_calling_insn(insn)) {
  		struct bpf_verifier_state *async_cb;
 =20
+ 		if (state->speculative)
+ 			return 0;
  		/* there is no real recursion here. timer and workqueue callbacks are a=
sync */
 +		/* there is no cgroup to take the storage from */
 +		if (env->prog->aux->cgroup_storage[BPF_CGROUP_STORAGE_SHARED] ||
 +		    env->prog->aux->cgroup_storage[BPF_CGROUP_STORAGE_PERCPU]) {
 +			verbose(env, "async callback in a program with cgroup storage\n");
 +			return -EINVAL;
 +		}
  		env->subprog_info[subprog].is_async_cb =3D true;
  		async_cb =3D push_async_cb(env, env->subprog_info[subprog].start,
  					 insn_idx, subprog,
@@@ -20834,46 -21913,109 +21938,109 @@@ static int do_check_block(struct bp=
f_ve
  			env->insn_idx++;
  		}
 =20
- 		if (state->speculative && insn_aux->nospec_result) {
- 			/* If we are on a path that performed a jump-op, this
- 			 * may skip a nospec patched-in after the jump. This can
- 			 * currently never happen because nospec_result is only
- 			 * used for the write-ops
- 			 * `*(size*)(dst_reg+off)=3Dsrc_reg|imm32` and helper
- 			 * calls. These must never skip the following insn
- 			 * (i.e., bpf_insn_successors()'s opcode_info.can_jump
- 			 * is false). Still, add a warning to document this in
- 			 * case nospec_result is used elsewhere in the future.
- 			 *
- 			 * All non-branch instructions have a single
- 			 * fall-through edge. For these, nospec_result should
- 			 * already work.
- 			 */
- 			if (verifier_bug_if((BPF_CLASS(insn->code) =3D=3D BPF_JMP ||
- 					     BPF_CLASS(insn->code) =3D=3D BPF_JMP32) &&
- 					    BPF_OP(insn->code) !=3D BPF_CALL, env,
- 					    "speculation barrier after jump instruction may not have the des=
ired effect"))
- 				return -EFAULT;
 -		/* only a store that stays gets it, see bpf_convert_ctx_accesses() */
++		/* End speculation at a retained store with a trailing barrier. */
+ 		if (state->speculative && insn_aux->nospec_result && !insn_aux->fastcal=
l_pattern &&
+ 		    bpf_is_mem_insn(insn) && BPF_MODE(insn->code) =3D=3D BPF_MEM) {
  process_bpf_exit:
  			account_current_path(env);
- 			mark_verifier_state_scratched(env);
- 			err =3D bpf_update_branch_counts(env, env->cur_state);
- 			if (err)
- 				return err;
- 			err =3D pop_stack(env, &prev_insn_idx, &env->insn_idx,
- 					pop_log);
- 			if (err < 0) {
- 				if (err !=3D -ENOENT)
- 					return err;
- 				break;
- 			} else {
- 				do_print_state =3D true;
- 				continue;
- 			}
+ 			bpf_free_verifier_state(env, state, false);
+ 			memset(state, 0, sizeof(*state));
+ 			return flow_drain(env);
+ 		}
+=20
+ 		/* if the insn pushed a part, the current state is a part too */
+ 		for (elem =3D env->head; elem; elem =3D elem->next)
+ 			again |=3D elem->again;
+ 		err =3D flow_drain(env);
+ 		if (err)
+ 			return err;
+=20
+ 		/* the parts of a state meet at the next insn */
+ 		if (env->insn_idx < insn_cnt &&
+ 		    (again || bpf_flow_is_bb_start(env, env->insn_idx))) {
+ 			account_current_path(env);
+ 			return bpf_flow_deliver(env, state, env->insn_idx, prev_insn_idx, fals=
e);
  		}
  	}
+ }
 =20
- 	return 0;
+ /* What the pass assumed about loops does not hold, see do_check_all() */
+ static bool pass_needs_restart(struct bpf_verifier_env *env)
+ {
+ 	return (env->restart && bpf_flow_loops_lost_bound(env)) || env->guards_l=
ate;
+ }
+=20
+ /*
+  * The loops that keep the current state apart pay for the work since the=
 last state, but not
+  * a loop that the state enters. A trip that is peeled on the budget of a=
 loop belongs to that
+  * loop. Such trips can use up the budget of an inner loop.
+  */
+ static void charge_loops(struct bpf_verifier_env *env, u64 cost)
+ {
+ 	const struct bpf_verifier_state *st =3D env->cur_state;
+ 	const struct loop_stack_entry *e;
+ 	struct bpf_loop *starved_loop =3D NULL;
+ 	int fr, i;
+=20
+ 	for (fr =3D st->curframe; env->pass && fr >=3D 0; fr--) {
+ 		for (i =3D st->frame[fr]->loop_stack_cnt - 1; i >=3D 0; i--) {
+ 			e =3D &st->frame[fr]->loop_stack[i];
+ 			if ((e->peeled || e->loop->disjoint_apart) &&
+ 			    (e->trip || e->loop->header !=3D st->insn_idx))
+ 				e->loop->this_pass.cost +=3D cost;
+ 			if (e->peeled && e->trip >=3D e->loop->peel_cnt) {
+ 				if (starved_loop && e->loop->partitioned)
+ 					starved_loop->this_pass.starved =3D
+ 						e->loop->this_pass.starves =3D true;
+ 				return;
+ 			}
+ 			if (e->loop->partitioned && !bpf_loop_has_budget(e->loop))
+ 				starved_loop =3D e->loop;
+ 		}
+ 	}
+ }
+=20
+ static int do_check(struct bpf_verifier_env *env)
+ {
+ 	bool level2 =3D env->log.level & BPF_LOG_LEVEL2;
+ 	u64 log_pos =3D env->log.end_pos, diag_pos =3D 0;
+ 	u64 cost =3D env->cost;
+ 	int prev_insn_idx, err;
+=20
+ 	err =3D bpf_flow_deliver(env, env->cur_state, env->insn_idx, -1, false);
+ 	while (!err && !(env->path_sensitive && env->cost >=3D env->failing_path=
_max_cost)) {
+ 		err =3D bpf_flow_next(env, &prev_insn_idx, &log_pos, &diag_pos);
+ 		/* at the limit the work on equations is not complete, such a pass prov=
es nothing */
+ 		if (err =3D=3D -ENOENT)
+ 			return bpf_check_limits(env);
+ 		if (err)
+ 			break;
+ 		charge_loops(env, env->cost - cost);
+ 		cost =3D env->cost;
+ 		/* A pass logs one basic block at a time. A path-sensitive run logs a f=
ull path. */
+ 		bpf_diag_event_log_restore(env, diag_pos);
+ 		if (!level2) {
+ 			bpf_vlog_reset(&env->log, log_pos);
+ 			env->prev_linfo =3D NULL;
+ 		}
+ 		err =3D do_check_block(env, prev_insn_idx);
+ 		if (env->bug)
+ 			return -EFAULT;
+ 		/* a pass had no error at this insn, possibly with a state that has mor=
e values */
+ 		if (err && env->path_sensitive && is_error_of_state(env, err) &&
+ 		    (env->cur_state->infeasible || env->cur_state->equations.infeasible=
 ||
+ 		     !bpf_failing_path_may_end_at(env, env->insn_idx))) {
+ 			bpf_free_verifier_state(env, env->cur_state, false);
+ 			memset(env->cur_state, 0, sizeof(*env->cur_state));
+ 			free_pushed_states(env);
+ 			err =3D 0;
+ 		}
+ 	}
+ 	/* bpf_flow_edge_unproven() noted it with the state that failed */
+ 	if (err && !bpf_insn_is_unproven(env))
+ 		note_error(env, err);
+ 	env->run_over_budget |=3D !err;
+ 	return err;
  }
 =20
  static int find_btf_percpu_datasec(struct btf *btf)

--/PoCzhzasBjJC5sz
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmsJp/oACgkQJNaLcl1U
h9Cgdgf/Sd/j3w9NuY65xVxvzrMsCU66equD86VLI+q8OEoqjjKeZqAUhk1XsA6z
YVMejQHO6276bzqcDELizjYRaUKr2r4erE8MEWtUskbVi0HbLM24swha+CLRURr2
aZTjo0mk76zMP/7A6tS90ceYH+cgLuSLcQhj4Cuk24FpmFOfVtHgtKi7n6MLruTM
AgZxI/3mBIDk2fSsl1+qW9jzs9cpVCxZ+eu/Zrz/UNrZ5gzi2hPKxwfktU0N+Ny5
L0M0US3TYcet8D1jlxe8XAEQweYcQzjsETTf+qH6X5pLrZ4fdD9BTOqtn+d8NUgM
CpZB9U7mgugBUcHIHol+iHxhKYkNtQ==
=LfCN
-----END PGP SIGNATURE-----

--/PoCzhzasBjJC5sz--
Re: linux-next: manual merge of the bpf-next tree with the bpf tree
#23766
Author: "Alexei Starovoitov"
Date: Fri, 27 Nov 2026 23:51
30 lines
11970 bytes
On Fri Nov 27, 2026 at 3:55 PM UTC, Mark Brown wrote:
> Hi all,
>
> Today's linux-next merge of the bpf-next tree got a conflict in:
>
>   kernel/bpf/verifier.c
>
> between commit:
>
>   02d3452bdd80c ("bpf: Set the run context for async callbacks")
>
> from the bpf tree and commit:
>
>   d83c595d9480e ("bpf: Put a barrier where no mask fits")
>
> 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.

The resolution looks correct. Sorry for the trouble.
We're seeing more and more conflicts between bpf and bpf-next,
since the verifier in bpf-next is completely different.
We'll try to sync bpf/bpf-next trees faster,
so you don't have to deal with this non-trivial conflicts.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads