Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796104796; b=MzxMAWhl4PXOmJ8WhtZJhR1IzoNMaKE4kUk2rXo+DcBurGMKj+MoPO/BthI4Qr47o7B2 f5C6FCP3OygcYFhCwYzDaBGgnrpa8ooFNMrJ0Kb/i+Zv/z6HpBzQCfVhp7FKsB5ru0J/g sMY6UgJUUSr/cioP/1R1v9x8HZvWeIJ72TQR2ZUnIx/xADutWD1lj4GYc159sR8Z8svFG QtOvypMBh2sRKs8onATLYAUhav+f3vXPrZGNHRvH+yPTcRcvTu+w/nd3533rCNNLgGGAD auQD0+2lWFDBKOZczUvs2IWpW4E1FZFbQlU5Fl3oQzkML4ON4sRQ3xpTCZ0Fb707yfA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796104796; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Hk4mOL1XwwXQaKV88NmyYiy7rVxnoi42hfz+mEQ6kMc=; b=wn2utAbQsi8fi28EXpjmocr+aYX6mmfOesXl082HQmsrH/lyzcTa0/okZ9/tpkibmtN9 egL1kHgX1nbfQxrjSaDdILRN7b2AHiH3mKbHz6XoJie/J9w3GGOZKjob0yAzXqs58c5d5 doQTHP46jiJDjsleIO5Bb4MBu3vlSaC1f4rwkGkqRHyeGyOl5srzxe74eebw8CggQk8Bi V5/BWT9oEZKF9axMloa4QSknLGhwhX/SCBuPUsJgRonjHzc0+gPNW5B07IQEyhFtxzk3q jgUgiZwOzS59C1cbTyleaD6kitidvOAmwL/dJzucYyBlPwxphqC3kXYMLEY+9JJ4RgA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=PeD28kxO; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DC1C606A325 for ; Tue, 1 Dec 2026 05:59:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=PeD28kxO Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5F231F00897; Tue, 1 Dec 2026 05:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796104795; bh=Hk4mOL1XwwXQaKV88NmyYiy7rVxnoi42hfz+mEQ6kMc=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=PeD28kxOz3qkO0apK83XOmAYG6M2AuGo9U+VynG/odMxzLrviwUFk3I0Vlp8kZFOn RR6Rty0j3ZrUI5vIkwpdrlgtRCvJFErB8Css/ksNpOuZZu4AaXFT56kwmAr6SQmrGQ GWBl9tOAcOE1CQ8EmQ4gWWUFiOoUmhzcJ9B3RPj5anHLHkNzhJVeVq7F7n9PHB0+UU aiPG2h9UgoFtngdaQfAk3F3/OTlv6dC67tJ3k24pkXjFqAagELvmxEeZXlsoxAKpw2 HDyKcxusbKlQ9b63/41sG/PAFNbCpIk5hLanAIn7UUe5eecZR6pPz3DPHpLSTiBYXN TUSpuArQd7KfQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH bpf-next v1 57/73] bpf: Use cancel_exit to leave a frame that the kernel cancels Reply-To: sashiko-reviews@lists.linux.dev To: "Kumar Kartikeya Dwivedi" , bpf@vger.kernel.org In-Reply-To: References: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 05:59:55 +0000 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] bpf: uninitialized R0 in check_func_call() when void global subprog unwinds -- commit 38251635c78fa170b21fce35b63620639aba52f3 Author: Kumar Kartikeya Dwivedi bpf: Use cancel_exit to leave a frame that the kernel cancels This commit separates kernel-initiated frame cancellation from the program's own unwinding by introducing cancel_exit and cancel_goto, and passes R0 through generated BPF_SITE_CALL landing pads in static functions across all programs. > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > index ed73f660d5cef..3cade295dd8d0 100644 > --- a/kernel/bpf/verifier.c > +++ b/kernel/bpf/verifier.c [ ... ] > @@ -12413,18 +12473,24 @@ static int check_func_call(struct bpf_verifier_= env *env, struct bpf_insn *insn, > } > } > =20 > - /* No state comes out of a global subprog, see unwind_frame() */ > - if (env->subprog_info[subprog].did_unwind && > - env->subprog_info[subprog].bail_unwinds) { > + /* > + * No state comes back from a global subprog. Push one for each way in= which it is > + * known to leave without returning: with unwind_exit and with cancel_= exit. > + */ > + for (i =3D 0; i < 2; i++) { > + const struct bpf_subprog_info *sub =3D &env->subprog_info[subprog]; > struct bpf_verifier_state *branch; > + bool kernel =3D i; > =20 > - err =3D check_unwound_return(env, *insn_idx, subprog); > + if (!(kernel ? sub->did_cancel : sub->did_unwind) || !sub->bail_unwin= ds) > + continue; > + err =3D check_unwound_return(env, *insn_idx, subprog, kernel); > if (err) > return err; > branch =3D push_stack(env, *insn_idx + 1, *insn_idx, false); > if (IS_ERR(branch)) > return PTR_ERR(branch); > - branch->unwound =3D true; > + branch->unwound =3D bpf_unwound_mark(kernel, false); > /* R0 has the value of the unwinding, also after a void function. */ > if (env->has_throw) > mark_reg_unknown(env, branch->frame[branch->curframe]->regs, > BPF_REG_0); [Severity: Medium] Does this leave R0 as NOT_INIT on the unwound branch (!kernel) when a void global subprog leaves with unwind_exit in a program without bpf_throw()? In check_func_call(), clear_caller_saved_regs() resets R0 to NOT_INIT, and when returns_void is true the block before this loop skips marking R0 as an unknown scalar. Because bpf_pad_passes_on() is now true for BPF_SITE_CALL in static functions even when !env->has_throw, unwind_frame() no longer overwrites R0 with bpf_cancelled_retval() and instead propagates NOT_INIT to the caller, causing the verifier to reject valid programs when a caller landing pad reads R0 or rethrows with unwind_exit. Should R0 be marked unknown whenever !kernel || env->has_throw? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796099737.gi= t.memxor@gmail.com?part=3D57