[patch V4 06/12] s390/uaccess: Use unsafe wrappers for ASM GOTO

Heiko Carstens hca at linux.ibm.com
Thu Oct 23 02:00:16 AEDT 2025


On Wed, Oct 22, 2025 at 02:49:09PM +0200, Thomas Gleixner wrote:
> ASM GOTO is miscompiled by GCC when it is used inside a auto cleanup scope:
> 
> bool foo(u32 __user *p, u32 val)
> {
> 	scoped_guard(pagefault)
> 		unsafe_put_user(val, p, efault);
> 	return true;
> efault:
> 	return false;
> }
> 
> It ends up leaking the pagefault disable counter in the fault path. clang
> at least fails the build.
> 
> S390 is not affected for unsafe_*_user() as it uses it's own local label
> already, but __get/put_kernel_nofault() lack that.
> 
> Rename them to arch_*_kernel_nofault() which makes the generic uaccess
> header wrap it with a local label that makes both compilers emit correct
> code.
> 
> Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
> Cc: Heiko Carstens <hca at linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger at linux.ibm.com>
> Cc: Sven Schnelle <svens at linux.ibm.com>
> Cc: linux-s390 at vger.kernel.org
> ---
>  arch/s390/include/asm/uaccess.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Heiko Carstens <hca at linux.ibm.com>


More information about the Linuxppc-dev mailing list