2023-12-06 01:16:28

by Michal Luczaj

[permalink] [raw]
Subject: [PATCH 1/2] x86/traps: Attempt UMIP fixup only on #GP(0)

Do not allow for UMIP exception fixup if the exception did not come
directly from the user space. This excludes #GP due to a bad IRET.

Signed-off-by: Michal Luczaj <[email protected]>
---
arch/x86/kernel/traps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index c876f1d36a81..1daa7cd9a76c 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -651,7 +651,7 @@ 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))
+ if (user_mode(regs) && !error_code && fixup_umip_exception(regs))
goto exit;
}

--
2.43.0