From: Sohil Mehta <sohil.mehta@intel.com>
To: Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, Andy Lutomirski <luto@kernel.org>,
Borislav Petkov <bp@alien8.de>
Cc: Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
"H . Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
Sohil Mehta <sohil.mehta@intel.com>,
Kiryl Shutsemau <kas@kernel.org>,
Brendan Jackman <jackmanb@google.com>,
Sean Christopherson <seanjc@google.com>,
Nam Cao <namcao@linutronix.de>,
Cedric Xing <cedric.xing@intel.com>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Tony Luck <tony.luck@intel.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Maciej Wieczor-Retman <m.wieczorretman@pm.me>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 2/5] x86/traps: Consolidate user fixups in the #GP handler
Date: Mon, 9 Mar 2026 11:10:26 -0700 [thread overview]
Message-ID: <20260309181029.398498-3-sohil.mehta@intel.com> (raw)
In-Reply-To: <20260309181029.398498-1-sohil.mehta@intel.com>
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 <dave.hansen@intel.com>
Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Tested-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
---
v3:
- Pickup review and tested-by tags.
v2:
- 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 4dbff8ef9b1c..614a281bd419 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -921,11 +921,6 @@ DEFINE_IDTENTRY_ERRORCODE(exc_general_protection)
cond_local_irq_enable(regs);
- 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;
+ 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;
+ if (!cpu_feature_enabled(X86_FEATURE_UMIP))
+ return false;
+
if (!regs)
return false;
--
2.43.0
next prev parent reply other threads:[~2026-03-09 18:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 18:10 [PATCH v3 0/5] x86: Enable LASS support with vsyscall=xonly mode Sohil Mehta
2026-03-09 18:10 ` [PATCH v3 1/5] x86/vsyscall: Reorganize the page fault emulation code Sohil Mehta
2026-03-09 18:10 ` Sohil Mehta [this message]
2026-03-09 18:10 ` [PATCH v3 3/5] x86/vsyscall: Restore vsyscall=xonly mode under LASS Sohil Mehta
2026-03-09 18:10 ` [PATCH v3 4/5] x86/vsyscall: Disable LASS if vsyscall mode is set to EMULATE Sohil Mehta
2026-03-09 18:10 ` [PATCH v3 5/5] x86/cpu: Remove LASS restriction on vsyscall emulation Sohil Mehta
2026-03-19 18:46 ` [PATCH v3 0/5] x86: Enable LASS support with vsyscall=xonly mode Sohil Mehta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260309181029.398498-3-sohil.mehta@intel.com \
--to=sohil.mehta@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrew.cooper3@citrix.com \
--cc=bp@alien8.de \
--cc=cedric.xing@intel.com \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jackmanb@google.com \
--cc=kas@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=m.wieczorretman@pm.me \
--cc=mingo@redhat.com \
--cc=namcao@linutronix.de \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=seanjc@google.com \
--cc=skhan@linuxfoundation.org \
--cc=tglx@kernel.org \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox