diff options
-rw-r--r-- | arch/x86/kernel/entry_64.S | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index bea8474744ff..e518928114db 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -593,13 +593,22 @@ ENTRY(native_iret) | |||
593 | .quad native_iret, bad_iret | 593 | .quad native_iret, bad_iret |
594 | .previous | 594 | .previous |
595 | .section .fixup,"ax" | 595 | .section .fixup,"ax" |
596 | /* force a signal here? this matches i386 behaviour */ | ||
597 | /* running with kernel gs */ | ||
598 | bad_iret: | 596 | bad_iret: |
599 | movq $11,%rdi /* SIGSEGV */ | 597 | /* |
600 | TRACE_IRQS_ON | 598 | * The iret traps when the %cs or %ss being restored is bogus. |
601 | ENABLE_INTERRUPTS(CLBR_ANY | ~(CLBR_RDI)) | 599 | * We've lost the original trap vector and error code. |
602 | jmp do_exit | 600 | * #GPF is the most likely one to get for an invalid selector. |
601 | * So pretend we completed the iret and took the #GPF in user mode. | ||
602 | * | ||
603 | * We are now running with the kernel GS after exception recovery. | ||
604 | * But error_entry expects us to have user GS to match the user %cs, | ||
605 | * so swap back. | ||
606 | */ | ||
607 | pushq $0 | ||
608 | |||
609 | SWAPGS | ||
610 | jmp general_protection | ||
611 | |||
603 | .previous | 612 | .previous |
604 | 613 | ||
605 | /* edi: workmask, edx: work */ | 614 | /* edi: workmask, edx: work */ |