BPF List
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org
Cc: ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net,
	eddyz87@gmail.com, kernel-team@fb.com, martin.lau@kernel.org,
	mason@kernel.org, ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v9 08/23] bpf: Refuse a landing pad that does not resume
Date: Thu, 8 Oct 2026 18:11:31 +0200	[thread overview]
Message-ID: <22958731-c1d0-4f8e-891f-1e58b4c321ba@linux.dev> (raw)
In-Reply-To: <14b2036055b5d1e4aa4d8fb77308eece081ef7326ef7afe208f7bd0ff3092136@mail.kernel.org>



On 10/8/26 10:57 AM, bot+bpf-ci@kernel.org wrote:
>> bpf: Refuse a landing pad that does not resume
> TL;DR: Commit message only: the patch also makes push_callback_call() reject
> callback subprogs that may unwind, even without a cleanup table, but the
> message doesn't mention it. Mention it or split it out?
>
>>      bpf: Refuse a landing pad that does not resume
>>
>>      A cleanup pad runs drop glue and calls bpf_unwind_resume(), so its frame
>>      returns and the unwind goes on. A catch pad carries on in its frame
>>      instead. Only the first is supported: bpf_unwind() rewrites every frame's
>>      return address in one pass, so a catch pad's caller would still resume
>>      at a pad.
>>
>>      Nothing in the record says which kind a pad is, but the code does: a
>>      cleanup pad reaches _Unwind_Resume, a catch pad a return. So the unwind
>>      marks the frame whose pad it enters, and refuses in the marked code:
>>
>>        refused                                  where
>>        ---------------------------------------  ----------------------------
>>        an exit: how a catch pad ends            the pad's own frame
>>        a tail call, a BPF_LD_[ABS|IND]: it      the pad's own frame
>>          leaves through an exit on a failed
>>          load
>>        an indirect jump: nothing a compiler     the pad's own frame
>>          frontend emits in a pad needs one
>>        a bpf_unwind(), a call to a global       the pad and its callees
>>          subprog that might_unwind
>>        a bpf_unwind_resume() outside a pad      any program
>>
>>      The first three are refused only in the pad's own frame: a subprog the
>>      pad calls may do them and still come back.
>>
>>      Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
> The patch also adds a refusal that this table does not list.
> push_callback_call() now calls bpf_exc_check_callback(), which returns
> -EINVAL for any callback subprog with might_unwind set:
>
>    verbose(env, "subprog %d may unwind and is used as a callback\n", subprog);
>
> This check is not about landing pads, and it is not gated on
> env->cleanup_info_cnt.  might_unwind is set for any bpf_unwind() call, so
> it also applies to programs with no cleanup table.  Later in the series,
> bpf_prog_may_unwind() makes that case reachable.
>
> The restriction looks needed, since bpf_unwind_rewrite() stops walking at the
> helper frame between a callback and its caller, while the verifier would model
> the unwind continuing into the caller's frames.
>
> Could the commit message mention this restriction and the reason for it, or
> could the callback check go into its own patch?

This is not a bug as mentioned in the above. It indeed may worthwhile to
have a separate commit for callback checking since this commit is about
'refuse a landing pad that does not resume'...

>
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/37747693645


  reply	other threads:[~2026-10-08 16:11 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08  7:49 [PATCH bpf-next v9 00/23] bpf: Run exception cleanup landing pads when bpf_unwind() unwinds Yonghong Song
2026-10-08  7:50 ` [PATCH bpf-next v9 01/23] bpf: Pack bpf_insn_aux_data flags into bit fields Yonghong Song
2026-10-08  7:50 ` [PATCH bpf-next v9 02/23] bpf: Accept the compiler's exception cleanup table at program load Yonghong Song
2026-10-08  7:50 ` [PATCH bpf-next v9 03/23] bpf: Add the bpf_unwind() and bpf_unwind_resume() kfuncs Yonghong Song
2026-10-08  7:50 ` [PATCH bpf-next v9 04/23] bpf: Keep a call site's landing pad in insn_aux_data, add lookups Yonghong Song
2026-10-08  8:01   ` sashiko-bot
2026-10-08 15:58     ` Yonghong Song
2026-10-08  7:50 ` [PATCH bpf-next v9 05/23] bpf: Mark covered call sites and check a program can take a table Yonghong Song
2026-10-08  7:50 ` [PATCH bpf-next v9 06/23] bpf: Make exception landing pads reachable in the CFG Yonghong Song
2026-10-08  7:50 ` [PATCH bpf-next v9 07/23] bpf: Verify an unwind through landing pads and epilogues Yonghong Song
2026-10-08  8:57   ` bot+bpf-ci
2026-10-08 16:07     ` Yonghong Song
2026-10-08  7:50 ` [PATCH bpf-next v9 08/23] bpf: Refuse a landing pad that does not resume Yonghong Song
2026-10-08  8:57   ` bot+bpf-ci
2026-10-08 16:11     ` Yonghong Song [this message]
2026-10-08  7:50 ` [PATCH bpf-next v9 09/23] bpf: Do not use a private stack for a program that can unwind Yonghong Song
2026-10-08  7:50 ` [PATCH bpf-next v9 10/23] bpf: Prepare JITed programs for dispatching cleanup pads Yonghong Song
2026-10-08  7:50 ` [PATCH bpf-next v9 11/23] bpf: Dispatch cleanup pads by rewriting return addresses Yonghong Song
2026-10-08  7:51 ` [PATCH bpf-next v9 12/23] bpf: Refuse a trampoline that calls a subprog that can unwind Yonghong Song
2026-10-08  8:14   ` sashiko-bot
2026-10-08 16:19     ` Yonghong Song
2026-10-08  7:51 ` [PATCH bpf-next v9 13/23] bpf, x86: Dispatch exception cleanup pads at run time Yonghong Song
2026-10-08  7:51 ` [PATCH bpf-next v9 14/23] bpf, arm64: " Yonghong Song
2026-10-08  8:39   ` bot+bpf-ci
2026-10-08 16:23     ` Yonghong Song
2026-10-08  7:51 ` [PATCH bpf-next v9 15/23] libbpf: Resolve the compiler's _Unwind_Resume to the kernel's kfunc Yonghong Song
2026-10-08  7:51 ` [PATCH bpf-next v9 16/23] libbpf: Add cleanup_info to bpf_prog_load_opts Yonghong Song
2026-10-08  8:12   ` sashiko-bot
2026-10-08 16:25     ` Yonghong Song
2026-10-08  7:51 ` [PATCH bpf-next v9 17/23] libbpf: Collect .bpf_cleanup records and pass them to the kernel Yonghong Song
2026-10-08  7:51 ` [PATCH bpf-next v9 18/23] libbpf: Carry the exception cleanup table through the light skeleton Yonghong Song
2026-10-08  7:51 ` [PATCH bpf-next v9 19/23] libbpf: Let the static linker carry .bpf_cleanup relocations Yonghong Song
2026-10-08  8:14   ` sashiko-bot
2026-10-08 16:26     ` Yonghong Song
2026-10-08  7:51 ` [PATCH bpf-next v9 20/23] selftests/bpf: Add end-to-end and negative .bpf_cleanup exception tests Yonghong Song
2026-10-08  7:51 ` [PATCH bpf-next v9 21/23] selftests/bpf: Add __set_global() and __ret_global() test tags Yonghong Song
2026-10-08  7:51 ` [PATCH bpf-next v9 22/23] selftests/bpf: Cover more accepted .bpf_cleanup exception shapes Yonghong Song
2026-10-08  7:51 ` [PATCH bpf-next v9 23/23] selftests/bpf: Load an exception cleanup program from a light skeleton Yonghong Song

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=22958731-c1d0-4f8e-891f-1e58b4c321ba@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    --cc=mason@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