Re: [PATCH -v2] x86/boot/compressed: Register dummy NMI handler in EFI boot loader, to avoid kdump crashes

From: Zeng Heng
Date: Tue Jan 10 2023 - 22:47:00 EST



On 2023/1/10 22:53, Borislav Petkov wrote:
On Tue, Jan 10, 2023 at 08:32:07PM +0800, Zeng Heng wrote:
And here is the context of mce-inject:

#0  relocate_kernel () at arch/x86/kernel/relocate_kernel_64.S:55
#1  0xffffffff81a57fc2 in machine_kexec (image=0xffff888101ef8400)
    at arch/x86/kernel/machine_kexec_64.c:391
Before we continue with this any further: are you doing this "exercise" in
qemu/kvm and nothing of that is happening on real hardware?

Real hardware and QEMU both can reproduce the issue.

Here is description about NMI from Intel 64 and IA-32 Architectures Software Developer's Manual in chapter 6.7.1:

While an NMI interrupt handler is executing, the processor blocks delivery of subsequent NMIs until the next execution of the IRET instruction. This blocking of NMIs prevents nested execution of the NMI handler. It is recommended that the NMI interrupt handler be accessed through an interrupt gate to disable maskable hardware interrupts (see Section 6.8.1, “Masking Maskable Hardware Interrupts”).