From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
To: Florian Fuchs <fuchsfl@gmail.com>, Rich Felker <dalias@libc.org>,
linux-sh@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sh: uaccess: Require offsettable operands for 64-bit user access
Date: Tue, 06 Oct 2026 07:38:37 +0200 [thread overview]
Message-ID: <addfdf7bdf5c01706c2859b8f73fa666b00d7032.camel@physik.fu-berlin.de> (raw)
In-Reply-To: <20260716165329.3418962-1-fuchsfl@gmail.com>
On Thu, 2026-07-16 at 18:53 +0200, Florian Fuchs wrote:
> The 64-bit __get_user_u64()/__put_user_u64() paths address the memory
> operand as %T2 (base+4). This base+4 requires an offsettable address,
> but "m" also allows the indexed mode @(R0,Rn) (e.g. for a variable-
> indexed array element), which has no displacement field for the +4.
> Depending on optimization this build fails with "invalid 'asm'" or an
> ICE in GCC's change_address_1.
>
> Require an offsettable memory operand, allowing GCC to reload an
> unsuitable indexed address into an appropriate form.
>
> Fixes: 2d2b308a8b7d ("sh: Implement __get_user_u64() required for 64-bit get_user()")
> Signed-off-by: Florian Fuchs <fuchsfl@gmail.com>
> ---
> The patch was verified on the J2 core on the Mimas v2 board. And booted
> on the Dreamcast SH4. checkpatch doesn't like the missing whitespaces
> around : I preferred not to touch the other unrelated lines, so I kept
> the local style.
>
> The original GCC ICE, without this patch can be seen here:
> https://lore.kernel.org/linux-sh/ef22a5de-d945-4080-9f4a-f5a1ab9de1dc@landley.net/
>
> arch/sh/include/asm/uaccess_32.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/sh/include/asm/uaccess_32.h b/arch/sh/include/asm/uaccess_32.h
> index 5d7ddc092afd..cef40414bfb1 100644
> --- a/arch/sh/include/asm/uaccess_32.h
> +++ b/arch/sh/include/asm/uaccess_32.h
> @@ -92,7 +92,7 @@ __asm__ __volatile__( \
> ".long 1b + 2, 3b\n\t" \
> ".previous" \
> :"=&r" (err), "=&r" (x) \
> - :"m" (__m(addr)), "i" (-EFAULT), "0" (err)); })
> + :"o" (__m(addr)), "i" (-EFAULT), "0" (err)); })
> #else
> #define __get_user_u64(x, addr, err) \
> ({ \
> @@ -116,7 +116,7 @@ __asm__ __volatile__( \
> ".long 1b + 2, 3b\n\t" \
> ".previous" \
> :"=&r" (err), "=&r" (x) \
> - :"m" (__m(addr)), "i" (-EFAULT), "0" (err)); })
> + :"o" (__m(addr)), "i" (-EFAULT), "0" (err)); })
> #endif
>
> #define __put_user_size(x,ptr,size,retval) \
> @@ -196,7 +196,7 @@ __asm__ __volatile__( \
> ".long 1b, 3b\n\t" \
> ".previous" \
> : "=r" (retval) \
> - : "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \
> + : "r" (val), "o" (__m(addr)), "i" (-EFAULT), "0" (retval) \
> : "memory"); })
> #else
> #define __put_user_u64(val,addr,retval) \
> @@ -218,7 +218,7 @@ __asm__ __volatile__( \
> ".long 1b, 3b\n\t" \
> ".previous" \
> : "=r" (retval) \
> - : "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \
> + : "r" (val), "o" (__m(addr)), "i" (-EFAULT), "0" (retval) \
> : "memory"); })
> #endif
>
Merged into for-next for v7.4.
Thanks,
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
prev parent reply other threads:[~2026-10-06 5:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 16:53 Florian Fuchs
2026-07-16 17:05 ` John Paul Adrian Glaubitz
2026-07-16 17:52 ` David Laight
2026-09-29 11:48 ` John Paul Adrian Glaubitz
2026-10-06 5:38 ` John Paul Adrian Glaubitz [this message]
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=addfdf7bdf5c01706c2859b8f73fa666b00d7032.camel@physik.fu-berlin.de \
--to=glaubitz@physik.fu-berlin.de \
--cc=dalias@libc.org \
--cc=fuchsfl@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@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
all inboxes | Powered by JetHome®