From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A616C3081AE; Mon, 13 Oct 2025 15:38:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760369890; cv=none; b=sF4lpH3rvtrIBJYJVZAsZj8QsT8BkTvIvZcRJ9hC0SE5oPhNo20A+WeZFrWBRTMZYVSFJP7xWi+uezB4x+lqKTBWq+vhpKM5eLSzw7AaAGXnkAcPL4O1jXUfW1LGJdaxDBrhGyAVg+Fb/jn2LVK4gLRDKbtIvXe8WGch8UwoK58= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760369890; c=relaxed/simple; bh=zO0VT8zcy0YXSZdqm4ieVx/Wb1XwQNAP9volosUXiww=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NG/NM/jjQ10k2aEoqpJymyMb/GkBVQMfXkWYPDqHFoA3ljvDHWDK4F03CeuV35bJ2xy/wkHCYXBG+jd/BOzPkOudWXURwDUAuReOFCbpkjx2rTx9O2a2J9zgzYMWtqXArHz2Py4ktKC3E5VGxTfrB5FJshOsA57G7ao7XUvxH2c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=B1IfaGRM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="B1IfaGRM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA964C4CEE7; Mon, 13 Oct 2025 15:38:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760369890; bh=zO0VT8zcy0YXSZdqm4ieVx/Wb1XwQNAP9volosUXiww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B1IfaGRMiajCbCb84Y9OmIkUpJSylNkJIFCmuRoPFFCXu8bUNrR7Wn5YrLXq3eMmw XvaOY9TrnnFSzHaZ5G4vua56mooReJ71eAHfR8+qYFccbcJKlmOobf5Zk7Bt1ZMxHe saW9pXTUV7+vyaAn9jip5UKriGrsitBTmTHUg6Jc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Michael Karcher , Andreas Larsson , Sasha Levin , John Paul Adrian Glaubitz Subject: [PATCH 6.17 404/563] sparc: fix accurate exception reporting in copy_to_user for Niagara 4 Date: Mon, 13 Oct 2025 16:44:25 +0200 Message-ID: <20251013144425.922097180@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251013144411.274874080@linuxfoundation.org> References: <20251013144411.274874080@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Karcher [ Upstream commit 5a746c1a2c7980de6c888b6373299f751ad7790b ] 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 bad calculation. This will fix the return value of copy_to_user in a specific faulting case. The behaviour of memcpy stays unchanged. Fixes: 957077048009 ("sparc64: Convert NG4copy_{from,to}_user to accurate exception reporting.") Tested-by: John Paul Adrian Glaubitz # on Oracle SPARC T4-1 Signed-off-by: Michael Karcher Reviewed-by: Andreas Larsson Link: https://lore.kernel.org/r/20250905-memcpy_series-v4-4-1ca72dda195b@mkarcher.dialup.fu-berlin.de Signed-off-by: Andreas Larsson Signed-off-by: Sasha Levin --- arch/sparc/lib/NG4memcpy.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc/lib/NG4memcpy.S b/arch/sparc/lib/NG4memcpy.S index 7ad58ebe0d009..df0ec1bd19489 100644 --- a/arch/sparc/lib/NG4memcpy.S +++ b/arch/sparc/lib/NG4memcpy.S @@ -281,7 +281,7 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ subcc %o5, 0x20, %o5 EX_ST(STORE(stx, %g1, %o0 + 0x00), memcpy_retl_o2_plus_o5_plus_32) EX_ST(STORE(stx, %g2, %o0 + 0x08), memcpy_retl_o2_plus_o5_plus_24) - EX_ST(STORE(stx, GLOBAL_SPARE, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_24) + EX_ST(STORE(stx, GLOBAL_SPARE, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_16) EX_ST(STORE(stx, %o4, %o0 + 0x18), memcpy_retl_o2_plus_o5_plus_8) bne,pt %icc, 1b add %o0, 0x20, %o0 -- 2.51.0