Re: [PATCH] sh: uaccess: Require offsettable operands for 64-bit user access
From: David Laight
Date: Thu Jul 16 2026 - 13:53:08 EST
On Thu, 16 Jul 2026 19:05:03 +0200
John Paul Adrian Glaubitz <glaubitz@xxxxxxxxxxxxxxxxxxx> wrote:
> Hi Florian,
>
> 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.
An alternative would be to pass 'addr' and 'addr + 4' separately so that
the C compilation adds in the offset.
With a bit more effort the define wouldn't need repeating for LE and BE.
There is a bug in the __put_user_u64 code - it is missing the exception
table entry for the second word.
(It is present in __get_user_u64, but a separate label would be better.)
I also wonder whether there should be non-mmu copies?
David