sparclinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Yznaga <anthony.yznaga@oracle.com>
To: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>,
	linux-kernel@vger.kernel.org
Cc: sparclinux@vger.kernel.org, Andreas Larsson <andreas@gaisler.com>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Subject: Re: [PATCH 2/4] sparc: fix accurate exception reporting in copy_{from_to}_user for UltraSPARC III
Date: Fri, 29 Aug 2025 18:57:36 -0700	[thread overview]
Message-ID: <528a5d4b-1e07-4379-afd6-7e58d423e713@oracle.com> (raw)
In-Reply-To: <20250826160312.2070-3-kernel@mkarcher.dialup.fu-berlin.de>



On 8/26/25 9:03 AM, Michael Karcher wrote:
> Based on a finding by Anthony Yznaga that the UltraSPARC III copy_from_user
> returns invalid values breaking other parts of the kernel in case of a
> fault, while the generic implementation is correct.

I think there should be a little more text about the nature of the 
failure. Maybe:

He observed that a BUG_ON in ext4 code with large folios enabled 
resulted from copy_from_user() returning impossibly large values greater 
than the size to be copied. This lead to __copy_from_iter() returning 
impossible values instead of the actual number of bytes it was able to copy.

Otherwise, the fix looks good.

Reviewed-by: Anthony Yznaga <anthony.yznaga@oracle.com>


> 
> Fixes: ee841d0aff64 ("sparc64: Convert U3copy_{from,to}_user to accurate exception reporting.")
> Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
> ---
>   arch/sparc/lib/U3memcpy.S | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/sparc/lib/U3memcpy.S b/arch/sparc/lib/U3memcpy.S
> index 9248d59c734c..bace3a18f836 100644
> --- a/arch/sparc/lib/U3memcpy.S
> +++ b/arch/sparc/lib/U3memcpy.S
> @@ -267,6 +267,7 @@ FUNC_NAME:	/* %o0=dst, %o1=src, %o2=len */
>   	faligndata	%f10, %f12, %f26
>   	EX_LD_FP(LOAD(ldd, %o1 + 0x040, %f0), U3_retl_o2)
>   
> +	and		%o2, 0x3f, %o2
>   	subcc		GLOBAL_SPARE, 0x80, GLOBAL_SPARE
>   	add		%o1, 0x40, %o1
>   	bgu,pt		%XCC, 1f
> @@ -336,7 +337,6 @@ FUNC_NAME:	/* %o0=dst, %o1=src, %o2=len */
>   	 * Also notice how this code is careful not to perform a
>   	 * load past the end of the src buffer.
>   	 */
> -	and		%o2, 0x3f, %o2
>   	andcc		%o2, 0x38, %g2
>   	be,pn		%XCC, 2f
>   	 subcc		%g2, 0x8, %g2


  parent reply	other threads:[~2025-08-30  1:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26 16:03 Fix accurate exception reporting in SPARC assembly Michael Karcher
2025-08-26 16:03 ` [PATCH 1/4] sparc: fix accurate exception reporting in copy_{from_to}_user for UltraSPARC Michael Karcher
2025-08-29 10:53   ` John Paul Adrian Glaubitz
2025-09-02 16:33   ` Rene Rebe
2025-08-26 16:03 ` [PATCH 2/4] sparc: fix accurate exception reporting in copy_{from_to}_user for UltraSPARC III Michael Karcher
2025-08-27  6:34   ` John Paul Adrian Glaubitz
2025-08-28 15:53   ` John Paul Adrian Glaubitz
2025-08-30  1:57   ` Anthony Yznaga [this message]
2025-08-30  8:35     ` Michael Karcher
2025-09-02 16:38   ` Rene Rebe
2025-08-26 16:03 ` [PATCH 3/4] sparc: fix accurate exception reporting in copy_{from_to}_user for Niagara Michael Karcher
2025-08-29 21:44   ` John Paul Adrian Glaubitz
2025-09-02 16:40   ` Rene Rebe
2025-09-02 16:47     ` John Paul Adrian Glaubitz
2025-09-02 16:51       ` Rene Rebe
2025-09-02 16:53         ` John Paul Adrian Glaubitz
2025-09-02 17:04           ` Rene Rebe
2025-09-02 17:11             ` John Paul Adrian Glaubitz
2025-09-02 21:51           ` René Rebe
2025-08-26 16:03 ` [PATCH 4/4] sparc: fix accurate exception reporting in copy_{from_to}_user for Niagara 4 Michael Karcher
2025-08-27  6:37   ` John Paul Adrian Glaubitz
2025-08-28 20:21   ` John Paul Adrian Glaubitz
2025-08-29 13:24     ` Michael Karcher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=528a5d4b-1e07-4379-afd6-7e58d423e713@oracle.com \
    --to=anthony.yznaga@oracle.com \
    --cc=andreas@gaisler.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=kernel@mkarcher.dialup.fu-berlin.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).