lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aMrREvFIXlZc1W5k@shell.armlinux.org.uk>
Date: Wed, 17 Sep 2025 16:17:38 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Peter Zijlstra <peterz@...radead.org>,
	kernel test robot <lkp@...el.com>,
	linux-arm-kernel@...ts.infradead.org,
	Nathan Chancellor <nathan@...nel.org>,
	Christophe Leroy <christophe.leroy@...roup.eu>,
	Darren Hart <dvhart@...radead.org>,
	Davidlohr Bueso <dave@...olabs.net>,
	André Almeida <andrealmeid@...lia.com>,
	x86@...nel.org, Alexander Viro <viro@...iv.linux.org.uk>,
	Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
	linux-fsdevel@...r.kernel.org
Subject: Re: [patch V2 1/6] ARM: uaccess: Implement missing
 __get_user_asm_dword()

On Wed, Sep 17, 2025 at 03:55:10PM +0200, Thomas Gleixner wrote:
> On Wed, Sep 17 2025 at 10:41, Russell King wrote:
> > On Wed, Sep 17, 2025 at 07:48:00AM +0200, Thomas Gleixner wrote:
> >
> > Putting together a simple test case, where the only change is making
> > __gu_val an unsigned long long:
> >
> > t.c: In function ‘get_ptr’:
> > t.c:40:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> >    40 |         (x) = (__typeof__(*(ptr)))__gu_val;                             \
> >       |               ^
> > t.c:21:9: note: in expansion of macro ‘__get_user_err’
> >    21 |         __get_user_err((x), (ptr), __gu_err, TUSER());                  \
> >       |         ^~~~~~~~~~~~~~
> > t.c:102:16: note: in expansion of macro ‘__get_user’
> >   102 |         return __get_user(p, ptr);
> >       |                ^~~~~~~~~~
> >
> > In order for the code you are modifying to be reachable, you need to
> > build with CONFIG_CPU_SPECTRE disabled. This is produced by:
> >
> > int get_ptr(void **ptr)
> > {
> >         void *p;
> >
> >         return __get_user(p, ptr);
> > }
> 
> Duh, yes. I hate get_user() and I did not notice, because the
> allmodconfig build breaks early due to frame size checks, so I was too
> lazy to find that config knob and built only a couple of things and an
> artificial test case for u64.
> 
> But it actually can be solved solvable by switching the casting to:
> 
>     (x) = *(__force __typeof__(*(ptr)) *) &__gu_val;
> 
> Not pretty, but after upping the frame size limit it builds an
> allmodconfig kernel.

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?

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ