From nobody Tue Oct 7 21:38:31 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (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 6DEAD23E320; Tue, 7 Oct 2025 06:54:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759820045; cv=none; b=N2R8/iGcJ+vqcfaeWonVxCwBo1hV96rDMWVMTflUik57Y7gjkMz8wyStJkCO8vOh6cxvWtVNZ9MuX2E4FA4903kebA8CDiSAEfe3lW4I732FU2ykz/PlYTKxFoaV6Ff4dH66Latx5yKLL7AM+KD+iId2JE6mGMZykq7I6MhcP+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759820045; c=relaxed/simple; bh=fToSm3F404n5oMzJvpVQXG31dFxiu2syuP8/cuc42Tk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MDsgSOZAMjhpYY0mY1mDlU9dMxdqO8OeUQb1k60Mc6Z48140RlyGXU2hN2EpdwYlJixHMTZKC4s2KMnpPj94xJdYMYTAOqRVKPupG68K1UpEPPIOnDfRdW7uQC/Qa6c7PMWEgcByHifvgvx6WfB6qEBBCTsnGGer6y2/mvEw570= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MFHStz/e; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MFHStz/e" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1759820043; x=1791356043; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fToSm3F404n5oMzJvpVQXG31dFxiu2syuP8/cuc42Tk=; b=MFHStz/ejIzeIHq9CAQCNy1IrDlT4/QAsyWhDMNVX4/F19LvPnyqoEko hTpt44hPEaYEPG4Tr9SQf1yVyWtOiJWpVOsdf2+JwGQyQPb18HfVcVVcs AlR3waqQFIDvBPDNlCHIYv+zvG15lNEz/RkmE0dPN8P6X0iJy1xH50/fm 36teefBFP0vz+Mw89qola0TZux5sO/BB8KDTC/uVKwNeSt3n1GDyJe6RW 8wiPg2pSzQ0WKXQRmT/aecU3w5iD+WF9g2sjAx6w4V2KTSOrL6qxZFvps kxs+UgT3UO/jUYcWZJzf5aoudM/j2UhOafkGqsKSw+icxEOQoGYtKcvpB A==; X-CSE-ConnectionGUID: cbXXOxX4SJCN6810asMNkw== X-CSE-MsgGUID: 0j0dXeKBTQCCqlZUmG28iQ== X-IronPort-AV: E=McAfee;i="6800,10657,11574"; a="72254507" X-IronPort-AV: E=Sophos;i="6.18,321,1751266800"; d="scan'208";a="72254507" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2025 23:54:02 -0700 X-CSE-ConnectionGUID: /07oEOVeQky7thGWhzSgAw== X-CSE-MsgGUID: W9a/EJe9TPavxP4/usmwrg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,321,1751266800"; d="scan'208";a="184354495" Received: from sohilmeh.sc.intel.com ([172.25.103.65]) by orviesa004.jf.intel.com with ESMTP; 06 Oct 2025 23:54:02 -0700 From: Sohil Mehta To: x86@kernel.org, Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov Cc: Jonathan Corbet , "H . Peter Anvin" , Andy Lutomirski , Josh Poimboeuf , Peter Zijlstra , Ard Biesheuvel , "Kirill A . Shutemov" , Sohil Mehta , Xin Li , David Woodhouse , Sean Christopherson , Rick Edgecombe , Vegard Nossum , Andrew Cooper , David Laight , Randy Dunlap , Geert Uytterhoeven , Kees Cook , Tony Luck , Alexander Shishkin , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org Subject: [PATCH v10 09/15] x86/traps: Consolidate user fixups in exc_general_protection() Date: Mon, 6 Oct 2025 23:51:13 -0700 Message-ID: <20251007065119.148605-10-sohil.mehta@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251007065119.148605-1-sohil.mehta@intel.com> References: <20251007065119.148605-1-sohil.mehta@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move the UMIP exception fixup along with the other user mode fixups, that is, under the common "if (user_mode(regs))" condition where the rest of the fixups reside. No functional change intended. Suggested-by: Dave Hansen Signed-off-by: Sohil Mehta Acked-by: Dave Hansen --- v10: - No change. --- 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 36354b470590..25b45193eb19 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c @@ -800,11 +800,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); @@ -819,6 +814,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 d432f3824f0c..3ce99cbcf187 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 --=20 2.43.0