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

Message ID 20231206004654.2986026-2-mhal@rbox.co
State New
Headers
Series [1/2] x86/traps: Attempt UMIP fixup only on #GP(0) |

Commit Message

Michal Luczaj Dec. 6, 2023, 12:43 a.m. UTC
  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 <mhal@rbox.co>
---
 arch/x86/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

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;
 	}