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=1796102724; b=jiAT6vDQwz6VtSEYH/93AhS3hdL2pgoDFqWBIM68nzc2/33x2MQ3GvgetpG65Bc42a6E dvojVo0nHmdlwHsrAAGTHwr1562wHl39fiRkOhSX1a8Qf2GVH6OHWxXamEjL5dRG6ivjv SqHXxauoepWur63eDqAxu821+d6v5IXcrhZscjN2gs9UCeryukrcTkpOIVs7Kb3u7/m8C frzxsHbieykqIEWKKFFNb7U7+jUNzeB6ucGiS0zH3yA/Ywfe45taWck4sEHU5FFo1zlxW ANSA5YAoj4AapFGFDPP4njsZptXfNp2aKOLLLkPCf4LUwqtgC50rVvdjYP1LBPcQqNA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796102724; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Uo4FKGrxXP2qjptaZ0TQveS5lEIj3GwDdYZQAMZErDw=; b=ivCkLs5f9Y5CVeTPSy4fiwj7FrSU8IJCciVfn/KJUDuPt9I1XgrgBCBMOh4y/RsDIF6h AavKy1inMlUsgslmEuaYf1FEgqYmyXoFQwSLrB6j+9+0f8TGOwLX1YhiN1KuKvRqJdKXw odh7UsS15c5qmTyjsyRL6nCMcTfKzi77LnHaxoVuCaImiMRVwhaXKG615HkuYqMFj5S7Z cYRvdEiCTKYYc9PXif0m61qIwLvsWOJRZyz5hVLGZAnTWHPO6t5fzrou9G6mfojuyXQ0k wKhDeEZph7xC3/olTgIm5kXL8jUmiuUBh7pb6d4BNy6UDva3Iagx1q6VgQ/ptzJeXRQ== 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="QRkb82F/"; 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 CD61B606A31A for ; Tue, 1 Dec 2026 05:25:24 +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=QRkb82F/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 824EE1F00893; Tue, 1 Dec 2026 05:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796102724; bh=Uo4FKGrxXP2qjptaZ0TQveS5lEIj3GwDdYZQAMZErDw=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=QRkb82F/tNx++rlSuj33XGuPaVRLs40CejYnJVuQqAkm07FLEAB0sCkWQXZ3TgQSO q4TO7L0lf7+gZFKFNmKIMmuKm9B8+Rt2x9Vo0YdECp5dTFeJr9IlJ5r/nLssBBGU3I YEllGe4ND5hMc2clxPMo1UpbC2naoMZ/BgQeWYigZCxnl/+ego5qKPCazzhJvOQHdD quIYK1UQw1ZklfppCiYUyU3ZBatoKyBiyTKR3fSmJOXYuK6C83dJiGxJIZCxuGhBPO +//DgXYsUlzbQhQKHgAnOh0qqGFMOSo39F0MCLxvhEyPeDl+CVIqEFFu87VCVi8uar PhAAPJLOqZ2Mw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH bpf-next v1 11/73] bpf: Let a state leave its frame at may_goto without an exit insn Reply-To: sashiko-reviews@lists.linux.dev To: "Kumar Kartikeya Dwivedi" , bpf@vger.kernel.org In-Reply-To: <06b67b943e30f8edcee49a59217a91114cd882d9.1796099737.git.memxor@gmail.com> References: <06b67b943e30f8edcee49a59217a91114cd882d9.1796099737.git.memxor@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 05:25:24 +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: false R2 entry liveness when exit_idx is bpf_throw() at subprog start -- commit 9ee4059c1175b782fb337afa593df33f1f44177a Author: Alexei Starovoitov bpf: Let a state leave its frame at may_goto without an exit insn This commit adds unwind_frame() so a state can leave its frame directly at a verifier-inserted may_goto or recursion guard during the main pass, and removes bail_insn in favor of exit_idx. > diff --git a/kernel/bpf/liveness.c b/kernel/bpf/liveness.c > index f6456e5be5fd1..4d04d17603ae2 100644 > --- a/kernel/bpf/liveness.c > +++ b/kernel/bpf/liveness.c > @@ -2991,10 +2991,10 @@ int bpf_compute_live_registers(struct bpf_verifie= r_env *env) > */ > insn_aux[i].zext_dst =3D def32 >=3D 0 && (mask_hi(out) & BIT(def32)); > } > - /* the exit that stands for 'r0 =3D 0; exit' may be dead code, see push= _unwind_exit() */ > + /* unwind_frame() compares states at this exit of the subprog, which ma= y be dead code */ > for (i =3D 0; i < env->subprog_cnt; i++) > - if (env->subprog_info[i].bail_insn >=3D 0) > - insn_aux[env->subprog_info[i].bail_insn].live_regs_before |=3D > + if (env->subprog_info[i].exit_idx !=3D U32_MAX) > + insn_aux[env->subprog_info[i].exit_idx].live_regs_before |=3D > BIT(BPF_REG_0) | (bpf_ret_reg_pair(env, i) ? BIT(BPF_REG_2) : 0); [Severity: Medium] Can replacing bail_insn with exit_idx mark R2 live at subprogram entry when exit_idx is a bpf_throw() call at sub->start? Unlike bail_insn, which was only set on BPF_EXIT instructions, exit_idx falls back to the first bpf_throw() call when a subprogram has no BPF_EXIT. If a static subprogram returns a register pair in R0:R2 (ret_reg_pair is true), takes 0 or 1 argument (arg_slot_cnt <=3D 1), has no BPF_EXIT, and begins with bpf_throw() at sub->start, exit_idx equals sub->start and BIT(BPF_REG_2) is added to insn_aux[sub->start].live_regs_before. code_arg_slots() then sees R2 live at sub->start and returns 2, causing btf_check_func_arg_match() to fail with -EINVAL, and analyze_subprog() and func_is_on_its_own() treat caller-saved R2 as a live incoming argument of the callee, rejecting valid callers that leave a stack pointer in R2. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796099737.gi= t.memxor@gmail.com?part=3D11