From nobody Mon Apr 6 09:15:11 2026 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 2D5D43B8D46; Thu, 19 Mar 2026 22:59:29 +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=1773961171; cv=none; b=FdIaEDbXNreGcj8PFtDqjpjrua1IOfVGnnxg6ReRHNWKVrIscDD6h0htj7Sp2YFbvE2O8wx0qNCaj3cMqqzFzhWOfsPaCXlTYPazTIiEMWAR5aKVlvdvTf75ReIc/eBg6II2sjEOVR7sHY1jIxCuyPFl6LJnAM/4QL2pPr7M9SA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773961171; c=relaxed/simple; bh=riIaZDt2YOkzq3CGFD15R5259f65WhH4K7I2LfjzV3k=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=q4v6j0pAKX6FyM7Z28dDN8YwJ8lk61mmCg1AXPbIN6jZTqy4O9qpZ1P+WD1NmQ0C5ws4eGe5K+EWt8C17MyiVGa/n6OWyMghd5fWvX5CuNszxHf3DwqnD8dMv3PbmreKhIFBtV0hExxXYnrTcVHGJhxTgBnsJFXp+r7x2VxJ4T4= 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=DNh3oF5t; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=q22HTdN0; 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="DNh3oF5t"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="q22HTdN0" Date: Thu, 19 Mar 2026 22:59:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773961168; 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=pZSYr7wg3p6yHrZsfzD/kqXypkk5/jqL9LL+WTT973Y=; b=DNh3oF5tc7npEEq9obnQTy74UssAJ1S3G130Jz/sLIp+JiGVFIsAZUfFeEs81PzzIjtMN0 2UBi7KM9P8Cb/620vQx+1fbgGqQrM9E8mIvZ8QMICNLhtuoRTKNa/6NzOJ6OMnFfdoyPoq J4ZLV2lsE/qOAYj+XZD0lKtwN9sYTUdN6mf+md1zPkzEOxTOtG5jaRTE3hJi6HJzNC4IiR bYXSDQ6IANeaFMIMmIolf/7wNQgGhpr9r6/hvRIsI7yiiYV8OoSmzua/YtQLB5XM66hdc/ XEBFTQZTyIq0kNeeSDGpBxawrYyPC5QgoboSoJIotUsmE1sQ3JBXP15CQJpBvQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773961168; 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=pZSYr7wg3p6yHrZsfzD/kqXypkk5/jqL9LL+WTT973Y=; b=q22HTdN0L31XiPWS50DO8pQpoLYM6p54mFo+a1pvcl5TIT+2zSpeCmEXE69iUmW1kNMeDT 1KQe4EG3XPdn66Bw== From: "tip-bot2 for Sohil Mehta" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cpu] x86/traps: Consolidate user fixups in the #GP handler Cc: Dave Hansen , Sohil Mehta , Dave Hansen , "H. Peter Anvin (Intel)" , "Maciej Wieczor-Retman" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260309181029.398498-3-sohil.mehta@intel.com> References: <20260309181029.398498-3-sohil.mehta@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177396116732.1647592.13983848339391932281.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 x86/cpu branch of tip: Commit-ID: 4e57fdd11083d5cd44febc4b6613777291ec936e Gitweb: https://git.kernel.org/tip/4e57fdd11083d5cd44febc4b661377729= 1ec936e Author: Sohil Mehta AuthorDate: Mon, 09 Mar 2026 11:10:26 -07:00 Committer: Dave Hansen CommitterDate: Thu, 19 Mar 2026 15:11:13 -07:00 x86/traps: Consolidate user fixups in the #GP handler Move the UMIP exception fixup under the common "if (user_mode(regs))" condition where the rest of user mode fixups reside. Also, move the UMIP feature check into its fixup function to keep the calling code consistent and clean. No functional change intended. Suggested-by: Dave Hansen Signed-off-by: Sohil Mehta Signed-off-by: Dave Hansen Reviewed-by: H. Peter Anvin (Intel) Acked-by: Dave Hansen Tested-by: Maciej Wieczor-Retman Link: https://patch.msgid.link/20260309181029.398498-3-sohil.mehta@intel.com --- arch/x86/kernel/traps.c | 8 +++----- arch/x86/kernel/umip.c | 3 +++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 4dbff8e..614a281 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c @@ -921,11 +921,6 @@ DEFINE_IDTENTRY_ERRORCODE(exc_general_protection) =20 cond_local_irq_enable(regs); =20 - if (static_cpu_has(X86_FEATURE_UMIP)) { - if (user_mode(regs) && fixup_umip_exception(regs)) - goto exit; - } - if (v8086_mode(regs)) { local_irq_enable(); handle_vm86_fault((struct kernel_vm86_regs *) regs, error_code); @@ -940,6 +935,9 @@ DEFINE_IDTENTRY_ERRORCODE(exc_general_protection) if (fixup_vdso_exception(regs, X86_TRAP_GP, error_code, 0)) goto exit; =20 + if (fixup_umip_exception(regs)) + goto exit; + gp_user_force_sig_segv(regs, X86_TRAP_GP, error_code, desc); goto exit; } diff --git a/arch/x86/kernel/umip.c b/arch/x86/kernel/umip.c index d432f38..3ce99cb 100644 --- a/arch/x86/kernel/umip.c +++ b/arch/x86/kernel/umip.c @@ -354,6 +354,9 @@ bool fixup_umip_exception(struct pt_regs *regs) void __user *uaddr; struct insn insn; =20 + if (!cpu_feature_enabled(X86_FEATURE_UMIP)) + return false; + if (!regs) return false; =20