BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v1 58/73] bpf: Check that a helper whose callback may unwind has an unwind label
Date: Tue, 01 Dec 2026 05:47:25 +0000	[thread overview]
Message-ID: <sashiko-outbox-242630@kernel.org> (raw)
In-Reply-To: <2907dc24ce96eb35a94b4d43a2b89928b3284905.1796099738.git.memxor@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] bpf: cb_pads placed in per_pass resets check_cb_pad() cache
  every pass
--

commit 380cfb3192a5afe13d0abaeae652daee9480f8e4
Author: Kumar Kartikeya Dwivedi <memxor@gmail.com>

bpf: Check that a helper whose callback may unwind has an unwind label

This commit checks at program load time that helpers, kfuncs, and map
callback ops listed as having an unwind label have a bpf_call_cb()
exception table entry.

> diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
> index c500504cbfe17..6efe11f458b7e 100644
> --- a/include/linux/bpf_verifier.h
> +++ b/include/linux/bpf_verifier.h
> @@ -1902,6 +1902,9 @@ struct bpf_verifier_env {
>  	bool run_over_budget;		/* in one of its functions, see find_failing_path() */
>  	bool restart;			/* see bpf_flow_next_is_no_bound() */
>  	bool guards_late;		/* see bpf_flow_needs_guard() */
> +	/* the helpers and kfuncs whose unwind label was found, see check_cb_pad() */
> +	unsigned long cb_pads[8];
> +	u8 cb_pad_cnt;
>  	bool pads_late;			/* a global subprog unwinds: see settle_late_unwinds() */
>  	bool faults_late;		/* a site is not what it seemed: see check_arena_site() */
>  	bool pad_releases;		/* see release_frame_resources() */

[Severity: Low]
Should cb_pads and cb_pad_cnt be placed outside the per_pass group in
struct bpf_verifier_env?

check_cb_pad() caches verified functions so each is checked once per load,
but fields in per_pass are restored from the initial snapshot by
check_funcs() -> restore_snapshot(env, initial) at the start of every
verifier pass and path-sensitive run, resetting cb_pad_cnt to 0 and
repeating the kallsyms and exception table scan on each pass.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796099737.git.memxor@gmail.com?part=58

  parent reply	other threads:[~2026-12-01  5:47 UTC|newest]

Thread overview: 118+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  4:38 [PATCH bpf-next v1 00/73] Cancellations Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 01/73] bpf: Refuse a program that is too large for bpf_prog->pages Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 02/73] bpf: Require CAP_PERFMON for unwind_exit and unwind_goto Kumar Kartikeya Dwivedi
2026-12-01  5:25   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 03/73] bpf: Reject bpf_percpu_obj_drop() of a type with special fields Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 04/73] bpf: Drop the edge after bpf_throw() from the control flow graph Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 05/73] bpf: Let a helper call its callback with an unwind label Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 06/73] bpf, x86, arm64: Add landings that redo what follows a helper call Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 07/73] bpf: Let a callback unwind out of a helper that has an unwind label Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 08/73] bpf: Let the inlined bpf_loop pass on a callback that unwinds Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 09/73] bpf: Give the helpers that call a callback an unwind label Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 10/73] bpf: Let the comparator of bpf_rbtree_add unwind Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 11/73] bpf: Let a state leave its frame at may_goto without an exit insn Kumar Kartikeya Dwivedi
2026-12-01  5:25   ` sashiko-bot
2026-12-01  4:38 ` [PATCH bpf-next v1 12/73] bpf: Choose what a cancelled program returns by its type Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 13/73] bpf: Emit landing pads that leave RCU sections Kumar Kartikeya Dwivedi
2026-12-01  5:41   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 14/73] bpf: Release locks and irq flags in landing pads Kumar Kartikeya Dwivedi
2026-12-01  5:41   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 15/73] bpf: Add unwind_goto after calls of subprogs Kumar Kartikeya Dwivedi
2026-12-01  5:41   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 16/73] bpf: Let the kernel cancel a program in a global subprog Kumar Kartikeya Dwivedi
2026-12-01  5:41   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 17/73] bpf: Release references in landing pads Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 18/73] bpf: Release iterators and dynptrs " Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 19/73] bpf: Check pointers for NULL " Kumar Kartikeya Dwivedi
2026-12-01  5:41   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 20/73] bpf: Let the kernel cancel a frame that holds references Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 21/73] bpf: Add unwind_goto after helpers with a callback Kumar Kartikeya Dwivedi
2026-12-01  5:41   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 22/73] bpf: Let a may_goto that the verifier adds go to its landing pad only Kumar Kartikeya Dwivedi
2026-12-01  5:41   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 23/73] bpf: Record why a callee is cancelled when its call gets no landing pad Kumar Kartikeya Dwivedi
2026-12-01  5:26   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 24/73] bpf: Record what each call acquires and releases Kumar Kartikeya Dwivedi
2026-12-01  5:31   ` sashiko-bot
2026-12-01  4:38 ` [PATCH bpf-next v1 25/73] bpf: Add hidden stack slots for landing pads Kumar Kartikeya Dwivedi
2026-12-01  5:40   ` sashiko-bot
2026-12-01  5:42   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 26/73] bpf: Use hidden slots for a pointer that has no location at a site Kumar Kartikeya Dwivedi
2026-12-01  5:25   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 27/73] bpf: Restore the sections of the call when a frame is cancelled Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 28/73] bpf: Let hidden slots follow what a subprog does for its caller Kumar Kartikeya Dwivedi
2026-12-01  5:41   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 29/73] bpf: Let a callee hold a reference that its call hands over Kumar Kartikeya Dwivedi
2026-12-01  5:41   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 30/73] bpf: Let a call clear the hidden slot of what its callee releases Kumar Kartikeya Dwivedi
2026-12-01  4:38 ` [PATCH bpf-next v1 31/73] bpf: Give a callee a hidden slot for the reference that it is handed Kumar Kartikeya Dwivedi
2026-12-01  5:26   ` bot+bpf-ci
2026-12-01  4:38 ` [PATCH bpf-next v1 32/73] bpf: Give unwind_goto a 32 bit offset and prepare it for arena accesses Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 33/73] bpf, x86: Go to the landing pad when an access to arena faults Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 34/73] bpf, arm64: " Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 35/73] bpf: Let a register be the location of a lock in a global variable Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 36/73] bpf: Cancel a program at a fault in arena Kumar Kartikeya Dwivedi
2026-12-01  5:52   ` sashiko-bot
2026-12-01  4:39 ` [PATCH bpf-next v1 37/73] bpf: Share one landing pad among accesses to arena where nothing is held Kumar Kartikeya Dwivedi
2026-12-01  5:41   ` bot+bpf-ci
2026-12-01  4:39 ` [PATCH bpf-next v1 38/73] bpf: Keep R0, R6-R9 and the stack live at a call of bpf_throw() Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 39/73] bpf: Refuse freplace on a function that can unwind Kumar Kartikeya Dwivedi
2026-12-01  5:25   ` bot+bpf-ci
2026-12-01  5:51   ` sashiko-bot
2026-12-01  4:39 ` [PATCH bpf-next v1 40/73] bpf: Let landing pads pass on the value of unwind_exit Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 41/73] bpf: Keep a reference of the caller that a function finds NULL Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 42/73] bpf: Make bpf_throw() cancel the program through landing pads Kumar Kartikeya Dwivedi
2026-12-01  5:41   ` bot+bpf-ci
2026-12-01  4:39 ` [PATCH bpf-next v1 43/73] bpf, x86: Remove the exception boundary Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 44/73] bpf, arm64: " Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 45/73] s390/bpf: " Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 46/73] powerpc64/bpf: " Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 47/73] bpf: Remove the stack walk of bpf_throw() Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 48/73] bpf: Find at a site that a frame holds more than a landing pad releases Kumar Kartikeya Dwivedi
2026-12-01  5:25   ` bot+bpf-ci
2026-12-01  4:39 ` [PATCH bpf-next v1 49/73] bpf: Cancel the program when the time of its own may_goto is up Kumar Kartikeya Dwivedi
2026-12-01  5:42   ` bot+bpf-ci
2026-12-01  6:09   ` sashiko-bot
2026-12-01  4:39 ` [PATCH bpf-next v1 50/73] bpf: Reject a program that has no landing pad for a fault in arena Kumar Kartikeya Dwivedi
2026-12-01  5:26   ` bot+bpf-ci
2026-12-01  4:39 ` [PATCH bpf-next v1 51/73] bpf: Log why a call is a site and which functions cannot be cancelled Kumar Kartikeya Dwivedi
2026-12-01  5:25   ` bot+bpf-ci
2026-12-01  4:39 ` [PATCH bpf-next v1 52/73] bpf: Add cancel_goto and cancel_exit, which only the verifier emits Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 53/73] bpf: Give the unwind label of a helper a second way in Kumar Kartikeya Dwivedi
2026-12-01  5:26   ` bot+bpf-ci
2026-12-01  4:39 ` [PATCH bpf-next v1 54/73] bpf, x86: Put the landing of unwind_goto after the function Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 55/73] bpf, x86: Return to cancel_goto at cancel_exit Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 56/73] bpf, arm64: " Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 57/73] bpf: Use cancel_exit to leave a frame that the kernel cancels Kumar Kartikeya Dwivedi
2026-12-01  5:42   ` bot+bpf-ci
2026-12-01  5:59   ` sashiko-bot
2026-12-01  4:39 ` [PATCH bpf-next v1 58/73] bpf: Check that a helper whose callback may unwind has an unwind label Kumar Kartikeya Dwivedi
2026-12-01  5:26   ` bot+bpf-ci
2026-12-01  5:47   ` sashiko-bot [this message]
2026-12-01  4:39 ` [PATCH bpf-next v1 59/73] bpf: Find the landing pads of a program that can only clean up Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 60/73] bpf: Don't let hidden stack words turn on the private stack Kumar Kartikeya Dwivedi
2026-12-01  5:25   ` bot+bpf-ci
2026-12-01  4:39 ` [PATCH bpf-next v1 61/73] bpf: Add a landing pad per site for frames that are cancelled already Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 62/73] bpf: Verify a cleanup pad for a frame that is cancelled Kumar Kartikeya Dwivedi
2026-12-01  5:41   ` bot+bpf-ci
2026-12-01  4:39 ` [PATCH bpf-next v1 63/73] bpf: Reject a program whose cleanup pad a cancellation cannot enter Kumar Kartikeya Dwivedi
2026-12-01  5:25   ` bot+bpf-ci
2026-12-01  4:39 ` [PATCH bpf-next v1 64/73] bpf: Find the code that a cleanup pad can reach Kumar Kartikeya Dwivedi
2026-12-01  5:41   ` bot+bpf-ci
2026-12-01  4:39 ` [PATCH bpf-next v1 65/73] bpf: Emit the stub, the entry and the remainder of a cleanup pad Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 66/73] bpf: Let the entry of a cleanup pad save the pointers of the frame Kumar Kartikeya Dwivedi
2026-12-01  5:42   ` bot+bpf-ci
2026-12-01  4:39 ` [PATCH bpf-next v1 67/73] bpf: Run the cleanup pads of a program when the kernel cancels it Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 68/73] bpf: End the path at a call of a global subprog that never returns Kumar Kartikeya Dwivedi
2026-12-01  5:26   ` bot+bpf-ci
2026-12-01  4:39 ` [PATCH bpf-next v1 69/73] bpf: Tell struct_ops when a program was cancelled Kumar Kartikeya Dwivedi
2026-12-01  5:26   ` bot+bpf-ci
2026-12-01  5:59   ` sashiko-bot
2026-12-01  4:39 ` [PATCH bpf-next v1 70/73] bpf: Tell struct_ops when cancel_exit returns to the kernel Kumar Kartikeya Dwivedi
2026-12-01  4:39 ` [PATCH bpf-next v1 71/73] bpf: Let a struct_ops say what a cancelled program returns Kumar Kartikeya Dwivedi
2026-12-01  5:25   ` bot+bpf-ci
2026-12-01  5:47   ` sashiko-bot
2026-12-01  4:39 ` [PATCH bpf-next v1 72/73] bpf: Give cancelled tcp_congestion_ops programs values that TCP can take Kumar Kartikeya Dwivedi
2026-12-01  5:46   ` sashiko-bot
2026-12-01  4:39 ` [PATCH bpf-next v1 73/73] sched_ext: Treat a cancelled program as a scheduler error Kumar Kartikeya Dwivedi
2026-12-01  5:25   ` bot+bpf-ci

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=sashiko-outbox-242630@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=memxor@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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