From: Mark Brown <broonie@kernel.org>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Eduard Zingerman <eddyz87@gmail.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>, bpf <bpf@vger.kernel.org>,
Networking <netdev@vger.kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Next Mailing List <linux-next@vger.kernel.org>
Subject: linux-next: manual merge of the bpf-next tree with the bpf tree
Date: Fri, 27 Nov 2026 15:55:39 +0000 [thread overview]
Message-ID: <awmn-8pxvHphS_xZ@sirena.org.uk> (raw)
[-- Attachment #1: Type: text/plain, Size: 7201 bytes --]
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.
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;
+ if (state->speculative)
+ return 0;
/* there is no real recursion here. timer and workqueue callbacks are async */
+ /* 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 = true;
async_cb = push_async_cb(env, env->subprog_info[subprog].start,
insn_idx, subprog,
@@@ -20834,46 -21913,109 +21938,109 @@@ static int do_check_block(struct bpf_ve
env->insn_idx++;
}
- 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)=src_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) == BPF_JMP ||
- BPF_CLASS(insn->code) == BPF_JMP32) &&
- BPF_OP(insn->code) != BPF_CALL, env,
- "speculation barrier after jump instruction may not have the desired 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->fastcall_pattern &&
+ bpf_is_mem_insn(insn) && BPF_MODE(insn->code) == BPF_MEM) {
process_bpf_exit:
account_current_path(env);
- mark_verifier_state_scratched(env);
- err = bpf_update_branch_counts(env, env->cur_state);
- if (err)
- return err;
- err = pop_stack(env, &prev_insn_idx, &env->insn_idx,
- pop_log);
- if (err < 0) {
- if (err != -ENOENT)
- return err;
- break;
- } else {
- do_print_state = true;
- continue;
- }
+ bpf_free_verifier_state(env, state, false);
+ memset(state, 0, sizeof(*state));
+ return flow_drain(env);
+ }
+
+ /* if the insn pushed a part, the current state is a part too */
+ for (elem = env->head; elem; elem = elem->next)
+ again |= elem->again;
+ err = flow_drain(env);
+ if (err)
+ return err;
+
+ /* 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, false);
}
}
+ }
- 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_late;
+ }
+
+ /*
+ * 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 = env->cur_state;
+ const struct loop_stack_entry *e;
+ struct bpf_loop *starved_loop = NULL;
+ int fr, i;
+
+ for (fr = st->curframe; env->pass && fr >= 0; fr--) {
+ for (i = st->frame[fr]->loop_stack_cnt - 1; i >= 0; i--) {
+ e = &st->frame[fr]->loop_stack[i];
+ if ((e->peeled || e->loop->disjoint_apart) &&
+ (e->trip || e->loop->header != st->insn_idx))
+ e->loop->this_pass.cost += cost;
+ if (e->peeled && e->trip >= e->loop->peel_cnt) {
+ if (starved_loop && e->loop->partitioned)
+ starved_loop->this_pass.starved =
+ e->loop->this_pass.starves = true;
+ return;
+ }
+ if (e->loop->partitioned && !bpf_loop_has_budget(e->loop))
+ starved_loop = e->loop;
+ }
+ }
+ }
+
+ static int do_check(struct bpf_verifier_env *env)
+ {
+ bool level2 = env->log.level & BPF_LOG_LEVEL2;
+ u64 log_pos = env->log.end_pos, diag_pos = 0;
+ u64 cost = env->cost;
+ int prev_insn_idx, err;
+
+ err = bpf_flow_deliver(env, env->cur_state, env->insn_idx, -1, false);
+ while (!err && !(env->path_sensitive && env->cost >= env->failing_path_max_cost)) {
+ err = bpf_flow_next(env, &prev_insn_idx, &log_pos, &diag_pos);
+ /* at the limit the work on equations is not complete, such a pass proves nothing */
+ if (err == -ENOENT)
+ return bpf_check_limits(env);
+ if (err)
+ break;
+ charge_loops(env, env->cost - cost);
+ cost = env->cost;
+ /* A pass logs one basic block at a time. A path-sensitive run logs a full path. */
+ bpf_diag_event_log_restore(env, diag_pos);
+ if (!level2) {
+ bpf_vlog_reset(&env->log, log_pos);
+ env->prev_linfo = NULL;
+ }
+ err = 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 more 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 = 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 |= !err;
+ return err;
}
static int find_btf_percpu_datasec(struct btf *btf)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next reply other threads:[~2026-11-27 15:55 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 15:55 Mark Brown [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-11-27 15:55 Mark Brown
2026-11-26 14:42 Mark Brown
2026-11-17 21:39 Mark Brown
2026-11-17 21:36 Mark Brown
2026-11-18 15:47 ` J4f J4f
2026-11-19 1:17 ` Alexei Starovoitov
2026-11-03 14:08 Mark Brown
2026-11-03 17:40 ` Alexei Starovoitov
2026-11-03 17:50 ` Mark Brown
2026-09-29 14:56 Mark Brown
2026-09-29 16:31 ` Alexei Starovoitov
2026-09-30 7:07 ` Jiri Olsa
2026-09-29 12:15 Mark Brown
2026-09-24 12:39 Mark Brown
2026-09-24 16:12 ` Ihor Solodrai
2026-09-24 16:22 ` Alexei Starovoitov
2026-09-22 10:05 Mark Brown
2026-09-21 9:49 Mark Brown
2026-09-21 12:12 ` Daniel Borkmann
2026-09-18 11:05 Mark Brown
2026-09-14 11:31 Mark Brown
2026-09-14 11:34 ` Daniel Borkmann
2026-09-03 14:10 Mark Brown
2026-09-06 23:18 ` Alexei Starovoitov
2026-04-01 12:29 Mark Brown
2026-04-01 15:27 ` Alexei Starovoitov
2026-02-24 12:39 Mark Brown
2026-02-24 16:22 ` Alexei Starovoitov
2025-11-06 0:35 Stephen Rothwell
2025-11-06 17:57 ` Andrii Nakryiko
2025-02-14 5:07 Stephen Rothwell
2025-02-14 5:33 ` Alexei Starovoitov
2025-02-14 5:40 ` Stephen Rothwell
2025-02-14 9:12 ` Jiri Olsa
2025-02-14 18:50 ` Alexei Starovoitov
2024-03-07 1:40 Stephen Rothwell
2023-03-06 22:58 Stephen Rothwell
2023-03-10 0:38 ` Stephen Rothwell
2023-03-10 3:18 ` Bagas Sanjaya
2022-11-21 1:27 Stephen Rothwell
2022-08-26 1:46 Stephen Rothwell
2022-08-25 0:50 Stephen Rothwell
2022-08-22 1:01 Stephen Rothwell
2021-12-05 23:39 Stephen Rothwell
2020-09-30 4:07 Stephen Rothwell
2020-10-02 3:59 ` Stephen Rothwell
2020-06-26 0:05 Stephen Rothwell
2020-07-06 1:43 ` Stephen Rothwell
2020-05-15 3:18 Stephen Rothwell
2019-10-08 22:47 Stephen Rothwell
2019-10-15 23:29 ` Stephen Rothwell
2019-10-07 22:48 Stephen Rothwell
2019-10-15 23:27 ` Stephen Rothwell
2019-04-17 1:08 Stephen Rothwell
2019-04-24 3:12 ` Stephen Rothwell
2018-12-04 1:09 Stephen Rothwell
2018-12-04 1:05 Stephen Rothwell
2018-11-12 0:54 Stephen Rothwell
2018-05-14 1:57 Stephen Rothwell
2018-05-14 20:41 ` Jakub Kicinski
2018-05-14 21:57 ` Stephen Rothwell
2018-05-02 2:09 Stephen Rothwell
2018-05-02 4:40 ` Song Liu
2018-05-02 5:50 ` Stephen Rothwell
2018-05-02 6:05 ` Song Liu
2018-04-26 0:53 Stephen Rothwell
2018-04-26 7:57 ` Daniel Borkmann
2018-02-26 0:41 Stephen Rothwell
2018-02-26 9:03 ` Daniel Borkmann
2018-02-26 23:28 ` Stephen Rothwell
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=awmn-8pxvHphS_xZ@sirena.org.uk \
--to=broonie@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=memxor@gmail.com \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®