From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796145535; b=qi7SmW5XHK9kO9qZWzwaT2lVXRBm8kwLNjRJsHBuJfWZcdJc/ezPd9eB3FBBCRWIQL0F 65QVDtmwS1HPTAP61EanugpDNygzTF/wBfLLnDXgEGJ6EEp5UfysV7c6sMgjl3lLkjJzH HTO3XLr5FCEWWreTU195mnCLYSr9WumAa+mEwuRWCvovr8Wiv6ci/z0vNiNgKtJTvqRHa f6txkjSLj0jQkm+jFD3C4iDdY9zW47NcWDWK/PIoBJtDc5pt/mi9ZpFIS8gfGOfgIbPf0 OwYoxhMl/6mEmWWVDWrlkjDTtKQydYDOhZN3hqsbHa1qxdmz+WZ8t0CQizFzbUfqRnw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796145535; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=uNVuRwcrUO3ln7qLMbbKVcPyQDjrtQ+1QP0CqnVGmbw=; b=Jxj14q7mPgVkrsgV+7Tm+mSrxxwCc95uDd+9qeuY3vGPinLg6Af98zOjfbU796lGy30V 3SA6T5tbVtDuIyOLAf+vCQPDTSbK/pZXhzFcOfWJsv8l8pbP2R0ywpCc7uMjiEr8CYeUB vk8MFgCDOE0+iE8WxrS8fdqeUpKYPvkBpXSfhOI7K/2SNKRa85ntpMvt9mPcFqgT6Kx6T NGFylz1JvxUJM8ptsL5ESw/1evXYwIZNkJt/z7QK7L8EiBAL0szEM5xvvVL5O+16a3SGP 8+1fy+a8l4hmpM0p7TKFPt27aBY96i6cB5Ow1Pck3jhQy4pDxK4ejVoItsSDOwyOdCg== 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=c7So2pD1; 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 E74F7606A322 for ; Tue, 1 Dec 2026 17:18:54 +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=c7So2pD1 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81B971F00897; Tue, 1 Dec 2026 17:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796145534; bh=uNVuRwcrUO3ln7qLMbbKVcPyQDjrtQ+1QP0CqnVGmbw=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=c7So2pD1qJKmR4DRrnYjnJpKYAESjcuE4qbSIEGMPijFrEy7jzxWgQfBSOZZfGEhj RrCIfCurMDprXR6Yerj0pHxgIQ+xSwFVSHZ++LTldezxWzUh2hTgz6yK+UNXDOKu8o yFm5uhNzi6aXx+li6Db+WrTZpoe2OiE3/pLNDrPPqkEG1I2Fg1F2uWNKFwKbKbJt2K UH4enUbrUPJpJQJfjojKpvtmL5tis+4PbrDqaw34RG14g2Ti4ehKf+0pSRbqLriqIp wu91fU1N4bUgSb+/VS8AesEO/Wtohdh63ds6bs9Zs9PYt4CNOv08WJ/OKBi18a43cv iqnstQW7alThg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 5/7] powerpc32/bpf: fix MOV folding with in-place operations Reply-To: sashiko-reviews@lists.linux.dev To: "Lukas Stockner" , bpf@vger.kernel.org In-Reply-To: <20261201165313.413960-6-lukas@lukasstockner.de> References: <20261201165313.413960-1-lukas@lukasstockner.de> <20261201165313.413960-6-lukas@lukasstockner.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 17:18:54 +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: - [High] powerpc32/bpf: chained MOV folding via in-place MOV loses source in bpf_jit_build_body() -- commit 2571d56115a2072d4ce2b83007a90bba1702c77c Author: Lukas Stockner powerpc32/bpf: fix MOV folding with in-place operations This commit updates the 3-operand MOV+ALU folding in bpf_jit_build_body() to use the MOV source register for both operands when the subsequent ALU instruction reads from the MOV destination register. > diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit= _comp32.c > index c6cc562cf88c8..2c3d94c94ed78 100644 > --- a/arch/powerpc/net/bpf_jit_comp32.c > +++ b/arch/powerpc/net/bpf_jit_comp32.c > @@ -371,6 +371,10 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *ima= ge, u32 *fimage, struct code > insn[i - 1].off =3D=3D 0) { > src2_reg =3D bpf_to_ppc(insn[i - 1].src_reg); > src2_reg_h =3D src2_reg - 1; > + if (BPF_SRC(code) =3D=3D BPF_X && insn[i].src_reg =3D=3D insn[i - 1].= dst_reg) { > + src_reg =3D src2_reg; > + src_reg_h =3D src2_reg_h; > + } > ctx->idx =3D addrs[i - 1] / 4; > } [Severity: High] Can this lose the original MOV source register when an in-place MOV (such as "w2 =3D w2" for 32-bit zero-extension) sits between a MOV and a third ALU instruction on the same destination register? For a sequence like "r2 =3D r1; w2 =3D w2; w2 +=3D w3": 1. At "w2 =3D w2" (i - 1), the new check folds it with "r2 =3D r1" (i - 2), rewinds ctx->idx to addrs[i - 2] / 4, records addrs[i - 1] =3D addrs[i -= 2], and emits the move from r1 into r2. 2. At "w2 +=3D w3" (i), insn[i - 1] is itself a BPF_MOV | BPF_X with dst_reg =3D=3D r2, so it matches the folding check again. However, src2= _reg is read from the unmodified insn[i - 1].src_reg (r2 instead of r1), and ctx->idx is rewound to addrs[i - 1] / 4 (which equals addrs[i - 2] / 4). The emitted instruction for "w2 +=3D w3" then overwrites the move from r1 a= nd computes r2 =3D r2 + r3 using the stale value of r2 instead of r1. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201165313.4139= 60-1-lukas@lukasstockner.de?part=3D5