diff options
-rw-r--r-- | arch/x86/kernel/entry_64.S | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index e0eca007dc0d..2de3e457bd4b 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -1624,11 +1624,12 @@ first_nmi: | |||
1624 | * | pt_regs | | 1624 | * | pt_regs | |
1625 | * +-------------------------+ | 1625 | * +-------------------------+ |
1626 | * | 1626 | * |
1627 | * The saved RIP is used to fix up the copied RIP that a nested | 1627 | * The saved stack frame is used to fix up the copied stack frame |
1628 | * NMI may zero out. The original stack frame and the temp storage | 1628 | * that a nested NMI may change to make the interrupted NMI iret jump |
1629 | * to the repeat_nmi. The original stack frame and the temp storage | ||
1629 | * is also used by nested NMIs and can not be trusted on exit. | 1630 | * is also used by nested NMIs and can not be trusted on exit. |
1630 | */ | 1631 | */ |
1631 | /* Do not pop rdx, nested NMIs will corrupt it */ | 1632 | /* Do not pop rdx, nested NMIs will corrupt that part of the stack */ |
1632 | movq (%rsp), %rdx | 1633 | movq (%rsp), %rdx |
1633 | CFI_RESTORE rdx | 1634 | CFI_RESTORE rdx |
1634 | 1635 | ||
@@ -1641,6 +1642,8 @@ first_nmi: | |||
1641 | .endr | 1642 | .endr |
1642 | CFI_DEF_CFA_OFFSET SS+8-RIP | 1643 | CFI_DEF_CFA_OFFSET SS+8-RIP |
1643 | 1644 | ||
1645 | /* Everything up to here is safe from nested NMIs */ | ||
1646 | |||
1644 | /* | 1647 | /* |
1645 | * If there was a nested NMI, the first NMI's iret will return | 1648 | * If there was a nested NMI, the first NMI's iret will return |
1646 | * here. But NMIs are still enabled and we can take another | 1649 | * here. But NMIs are still enabled and we can take another |
@@ -1667,9 +1670,8 @@ end_repeat_nmi: | |||
1667 | 1670 | ||
1668 | /* | 1671 | /* |
1669 | * Everything below this point can be preempted by a nested | 1672 | * Everything below this point can be preempted by a nested |
1670 | * NMI if the first NMI took an exception. Repeated NMIs | 1673 | * NMI if the first NMI took an exception and reset our iret stack |
1671 | * caused by an exception and nested NMI will start here, and | 1674 | * so that we repeat another NMI. |
1672 | * can still be preempted by another NMI. | ||
1673 | */ | 1675 | */ |
1674 | pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ | 1676 | pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ |
1675 | subq $ORIG_RAX-R15, %rsp | 1677 | subq $ORIG_RAX-R15, %rsp |