[patch V2 1/6] ARM: uaccess: Implement missing __get_user_asm_dword()
Thomas Gleixner
tglx at linutronix.de
Wed Sep 17 12:25:09 PDT 2025
On Wed, Sep 17 2025 at 18:34, Russell King wrote:
> On Wed, Sep 17, 2025 at 10:14:24AM -0700, Nathan Chancellor wrote:
>> On Wed, Sep 17, 2025 at 04:17:38PM +0100, Russell King (Oracle) wrote:
>> > For me, this produces:
>> >
>> > get-user-test.c:41:16: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
>> > 41 | (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \
>> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> >
>> > with arm-linux-gnueabihf-gcc (Debian 14.2.0-19) 14.2.0
>> >
>> > Maybe you're using a different compiler that doesn't issue that warning?
>>
>> Maybe because the kernel uses -fno-strict-aliasing, which presumably
>> turns off -Wstrict-aliasing?
>
> Thanks, I'd forgotten to pick the -f flags for building the out of tree
> test. Yes, that does work, but I wonder whether the powerpc 32-bit
> approach with __long_type() that Christophe mentioned would be better.
> That also appears to avoid all issues, and doesn't need the use of
> the nasty __force, address-of and deref trick.
Hmm. I just noticed that include/asm-generic/uaccess.h does exactly the
same what I did with the per size case variables and that seems to be
not subject to endless bot complaints either.
But sure, the PPC trick is neat too. No strong preference, just that I'm
leaning towards the per case split up as it's less obfuscated IMO.
Thanks,
tglx
More information about the linux-arm-kernel
mailing list