From nobody Fri Oct 3 06:36:48 2025 Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C9612DCF55; Thu, 4 Sep 2025 22:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=130.133.4.66 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757023429; cv=none; b=jjT7+LHyIB8ptS6qUFBkaWkxeTd0kg2NgJlE6wL3Z50sy2HE+lbd/9JRUz70cEwpQVZEgJukjEWW+BgUOmXgwrw/Mv9GqOyulG3q03orhj1lAKhsVDsgxvgzKC0MPi+aN2zLDNauhlFijUCGjPcZHw4UynAwyKc+MTrB2N4Cgb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757023429; c=relaxed/simple; bh=WqcDo6tdhzDxNEaRlGwvJ/3NEtjIz7qn2K6+WOAmmH8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Shj0XgXFs1Cl+RbjR4XKL411ODuEFqH8JiQd7HTeGXGEBfjTU3wWgF5W9xEV3aygJ6GihcDEQE1SK9C/pinvyYsM/q+pdCkO+LXDygGj8qyT+XmCn3XyFQF6C3rEeOLAfyav9EDLrQO/zPyTaefoCvxtA97dIZfeP4AqbdVUfbA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mkarcher.dialup.fu-berlin.de; spf=pass smtp.mailfrom=zedat.fu-berlin.de; dkim=pass (2048-bit key) header.d=fu-berlin.de header.i=@fu-berlin.de header.b=otW0zT0z; arc=none smtp.client-ip=130.133.4.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mkarcher.dialup.fu-berlin.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zedat.fu-berlin.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fu-berlin.de header.i=@fu-berlin.de header.b="otW0zT0z" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fu-berlin.de; s=fub01; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:From: Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:In-Reply-To: References; bh=c/smPJ5cqqeUFArcOKPQwnin0Vhj5pge1Y5vI9zqoBA=; t=1757023427; x=1757628227; b=otW0zT0zTHyracN/8T0bgMDXaWCN0pnpudXw77NQ9RwHN8kCYSairarLe9xuN wZQnfdxP5k05GrHKv8hDfQQoFyPiuZuIx359WTDrTHJKxV17Rlu+jLd81xh4McH1PIQoO6yKaKHK0 nBmXBRqTjUdyeTU3OXyANYP0t6ibT8O88JR8qWJV2RoGidCWEYTx33+H3+T3i6+N712bEKT2QqWlz SiRsqtIqUJo11DNy+9QyxwYMlgoenxMVVITryMhXDmjKjG9y8Y/IiiHXMhnvpbsk7ERXuONisM+yn Zec0N8fVqrYo6MHKPIgEu4+aSjCvkvIe0T71wHfgazvQdjPmyQ==; Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.98) with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (envelope-from ) id 1uuI3V-00000000z7D-00OS; Fri, 05 Sep 2025 00:03:45 +0200 Received: from 89-103-142-46.pool.kielnet.net ([46.142.103.89] helo=Geist14.) by inpost2.zedat.fu-berlin.de (Exim 4.98) with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (envelope-from ) id 1uuI3U-00000002DJL-3M5a; Fri, 05 Sep 2025 00:03:44 +0200 From: Michael Karcher Date: Fri, 05 Sep 2025 00:03:30 +0200 Subject: [PATCH v4 1/5] sparc: fix accurate exception reporting in copy_{from_to}_user for UltraSPARC Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250905-memcpy_series-v4-1-1ca72dda195b@mkarcher.dialup.fu-berlin.de> References: <20250905-memcpy_series-v4-0-1ca72dda195b@mkarcher.dialup.fu-berlin.de> In-Reply-To: <20250905-memcpy_series-v4-0-1ca72dda195b@mkarcher.dialup.fu-berlin.de> To: Andreas Larsson Cc: sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Karcher , John Paul Adrian Glaubitz , Anthony Yznaga , =?utf-8?q?Ren=C3=A9_Rebe?= , Jonathan 'theJPster' Pallant X-Mailer: b4 0.14.2 X-Original-Sender: kernel@mkarcher.dialup.fu-berlin.de X-ZEDAT-Hint: PO The referenced commit introduced exception handlers on user-space memory references in copy_from_user and copy_to_user. These handlers return from the respective function and calculate the remaining bytes left to copy using the current register contents. This commit fixes a couple of bad calculations. This will fix the return value of copy_from_user and copy_to_user in the faulting case. The behaviour of memcpy stays unchanged. Fixes: cb736fdbb208 ("sparc64: Convert U1copy_{from,to}_user to accurate ex= ception reporting.") Tested-by: John Paul Adrian Glaubitz # on QE= MU 10.0.3 Tested-by: Ren=C3=A9 Rebe # on Ultra 5 UltraSparc IIi Tested-by: Jonathan 'theJPster' Pallant # on Sun = Netra T1 Signed-off-by: Michael Karcher --- arch/sparc/lib/U1memcpy.S | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/arch/sparc/lib/U1memcpy.S b/arch/sparc/lib/U1memcpy.S index 635398ec7540ee3d344151ddc4c6f07ad41e11f9..154fbd35400ca8fe547c222d26a= ec18f46fcb1d2 100644 --- a/arch/sparc/lib/U1memcpy.S +++ b/arch/sparc/lib/U1memcpy.S @@ -164,17 +164,18 @@ ENTRY(U1_gs_40_fp) retl add %o0, %o2, %o0 ENDPROC(U1_gs_40_fp) -ENTRY(U1_g3_0_fp) - VISExitHalf - retl - add %g3, %o2, %o0 -ENDPROC(U1_g3_0_fp) ENTRY(U1_g3_8_fp) VISExitHalf add %g3, 8, %g3 retl add %g3, %o2, %o0 ENDPROC(U1_g3_8_fp) +ENTRY(U1_g3_16_fp) + VISExitHalf + add %g3, 16, %g3 + retl + add %g3, %o2, %o0 +ENDPROC(U1_g3_16_fp) ENTRY(U1_o2_0_fp) VISExitHalf retl @@ -547,18 +548,18 @@ FUNC_NAME: /* %o0=3Ddst, %o1=3Dsrc, %o2=3Dlen */ 62: FINISH_VISCHUNK(o0, f44, f46) 63: UNEVEN_VISCHUNK_LAST(o0, f46, f0) =20 -93: EX_LD_FP(LOAD(ldd, %o1, %f2), U1_g3_0_fp) +93: EX_LD_FP(LOAD(ldd, %o1, %f2), U1_g3_8_fp) add %o1, 8, %o1 subcc %g3, 8, %g3 faligndata %f0, %f2, %f8 - EX_ST_FP(STORE(std, %f8, %o0), U1_g3_8_fp) + EX_ST_FP(STORE(std, %f8, %o0), U1_g3_16_fp) bl,pn %xcc, 95f add %o0, 8, %o0 - EX_LD_FP(LOAD(ldd, %o1, %f0), U1_g3_0_fp) + EX_LD_FP(LOAD(ldd, %o1, %f0), U1_g3_8_fp) add %o1, 8, %o1 subcc %g3, 8, %g3 faligndata %f2, %f0, %f8 - EX_ST_FP(STORE(std, %f8, %o0), U1_g3_8_fp) + EX_ST_FP(STORE(std, %f8, %o0), U1_g3_16_fp) bge,pt %xcc, 93b add %o0, 8, %o0 =20 --=20 2.50.1