From nobody Mon Dec 15 18:51:02 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B712334FF46; Wed, 29 Oct 2025 10:24:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761733458; cv=none; b=pR462p/cMivJaUYzuk46OX62aHwNYvBYrwOFAr9BaThX5s5NSnJ/334V+1AueAJngCxawgl9HkZCGwIbsI9Z1dCujmzv2/OnGvRxdznXVc7nwnGIhDtpbFoINeZOK16TNKRnMnNJ4PJKWUaREV5erm8FA25ZzPyv4bNoer3yAyc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761733458; c=relaxed/simple; bh=tRUbCWLZwj6H4aEqqhAU+gsuiVHLApNyXKIEmawe1QE=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=ec4+GrbBS1YfjsZYRoUJgZv97ks4q84UZCnx7BvCrjdVbTlSmAOGw4Wr3iIWucHtQ8pmSpTjltLbvOtK6uhsDoJl2qI2XUtEm/ldJJpjjupkMjg28jv0ywHPZxjmnRVS/H1HMa7Rhi4YHrPSFZAsMs/caxqZ8pzXzc5Tp4z0VqA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=iiRIlid9; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=/aAVnafp; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="iiRIlid9"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="/aAVnafp" Date: Wed, 29 Oct 2025 10:24:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1761733455; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GdS2KY5g61tbNWTHTMkOvKBLyiLy7tWYuDTx2lnxhAQ=; b=iiRIlid9ADeTpoKCtyzhwP2GrwFqiiGBqQIF9MV+EQ66F630QHGxYBVGbxpKnCgMd3tNdy NohWAre8WZeSrDe68Yk3H1hm0vlGlBxtkodcmIl2MWAHOMN167Dy7WI4IVNgDrzyJYWfg6 ZSRZjRd9vRhb6ijQrEc2TiptXBz4z34x/Q+GkQ0S80iG5eIvV+LfSiLJemyEj/ia6lYVLQ 8/9639gkmAMyiQeq4xD6K8UQb/NPwXjILF24eiLGQw7Tu8N3q5MsgYZusYZPpClLXMYljo MbYUB/n6xo1mddM+57IrQBx6UoSw0Cstt3jCee0BkEOlaGeKsJiZJ5HkxpVcKw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1761733455; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GdS2KY5g61tbNWTHTMkOvKBLyiLy7tWYuDTx2lnxhAQ=; b=/aAVnafpSEscVYNyHFVR+J2zhAWNXQvUviCKgB2TNEDAZYuWsIkRf3UydSZUoWPISFa/PU ENZP/5DSE0qSwaDw== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/rseq] x86/uaccess: Use unsafe wrappers for ASM GOTO Cc: Thomas Gleixner , "Peter Zijlstra (Intel)" , Mathieu Desnoyers , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20251027083745.294359925@linutronix.de> References: <20251027083745.294359925@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <176173345383.2601451.13741544185374027643.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the core/rseq branch of tip: Commit-ID: ed1346327dfe9f63de316acb18ae4b5faed8f37f Gitweb: https://git.kernel.org/tip/ed1346327dfe9f63de316acb18ae4b5fa= ed8f37f Author: Thomas Gleixner AuthorDate: Mon, 27 Oct 2025 09:43:46 +01:00 Committer: Peter Zijlstra CommitterDate: Wed, 29 Oct 2025 11:07:08 +01:00 x86/uaccess: Use unsafe wrappers for ASM GOTO 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. Rename unsafe_*_user() to arch_unsafe_*_user() which makes the generic uaccess header wrap it with a local label that makes both compilers emit correct code. Same for the kernel_nofault() variants. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Mathieu Desnoyers Link: https://patch.msgid.link/20251027083745.294359925@linutronix.de --- arch/x86/include/asm/uaccess.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 91a3fb8..367297b 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -528,18 +528,18 @@ static __must_check __always_inline bool user_access_= begin(const void __user *pt #define user_access_save() smap_save() #define user_access_restore(x) smap_restore(x) =20 -#define unsafe_put_user(x, ptr, label) \ +#define arch_unsafe_put_user(x, ptr, label) \ __put_user_size((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)), label) =20 #ifdef CONFIG_CC_HAS_ASM_GOTO_OUTPUT -#define unsafe_get_user(x, ptr, err_label) \ +#define arch_unsafe_get_user(x, ptr, err_label) \ do { \ __inttype(*(ptr)) __gu_val; \ __get_user_size(__gu_val, (ptr), sizeof(*(ptr)), err_label); \ (x) =3D (__force __typeof__(*(ptr)))__gu_val; \ } while (0) #else // !CONFIG_CC_HAS_ASM_GOTO_OUTPUT -#define unsafe_get_user(x, ptr, err_label) \ +#define arch_unsafe_get_user(x, ptr, err_label) \ do { \ int __gu_err; \ __inttype(*(ptr)) __gu_val; \ @@ -618,11 +618,11 @@ do { \ } while (0) =20 #ifdef CONFIG_CC_HAS_ASM_GOTO_OUTPUT -#define __get_kernel_nofault(dst, src, type, err_label) \ +#define arch_get_kernel_nofault(dst, src, type, err_label) \ __get_user_size(*((type *)(dst)), (__force type __user *)(src), \ sizeof(type), err_label) #else // !CONFIG_CC_HAS_ASM_GOTO_OUTPUT -#define __get_kernel_nofault(dst, src, type, err_label) \ +#define arch_get_kernel_nofault(dst, src, type, err_label) \ do { \ int __kr_err; \ \ @@ -633,7 +633,7 @@ do { \ } while (0) #endif // CONFIG_CC_HAS_ASM_GOTO_OUTPUT =20 -#define __put_kernel_nofault(dst, src, type, err_label) \ +#define arch_put_kernel_nofault(dst, src, type, err_label) \ __put_user_size(*((type *)(src)), (__force type __user *)(dst), \ sizeof(type), err_label) =20