Re: [PATCH bpf v1 1/2] bpf: Fix exception exit lock checking for subprogs
From: Kumar Kartikeya Dwivedi
Date: Mon Mar 16 2026 - 21:24:10 EST
On Tue, 17 Mar 2026 at 02:02, <bot+bpf-ci@xxxxxxxxxx> wrote:
>
> > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> > --- a/kernel/bpf/verifier.c
> > +++ b/kernel/bpf/verifier.c
> > @@ -20911,7 +20911,8 @@ static int process_bpf_exit_full(struct bpf_verifier_env *env,
> > * state when it exits.
> > */
> > int err = check_resource_leak(env, exception_exit,
> > - !env->cur_state->curframe,
> > + exception_exit || !env->cur_state->curframe,
> > + exception_exit ? "bpf_throw" :
> > "BPF_EXIT instruction in main prog");
Fix LGTM. Thanks.
> > if (err)
> > return err;
>
> This looks like a bug fix but appears to be missing a Fixes: tag.
> The buggy check_lock = !curframe logic was introduced when the
> inline code in do_check() was refactored into process_bpf_exit_full()
> and check_resource_leak() in commit 2d419c44658f ("bpf: add fsession
> support"). Should this have:
>
> Fixes: 2d419c44658f ("bpf: add fsession support")
>
The fixes tag is wrong. It goes all the way back to f18b03fabaa9b.
I was scratching my head for a while, since we already have one test
to prevent this, but it turns out it's broken.
If we look at test reject_subprog_with_rcu_read_lock, it made the
mistake of returning directly.
Since the throw validation wasn't correct, the error instead comes
because of not closing the RCU section and exiting the program.
If we do the unlock without returning directly it starts failing
(i.e., unexpectedly succeeding).
I would rather change that test to fix it here in this commit, then
add more cases for IRQ, preempt lock etc. around it in the next one to
increase coverage.
With that the commit log could be made more clearer.
pw-bot: cr
>
> ---
> 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/23172639489