• Borislav Petkov's avatar
    x86/mce: Fixup exception only for the correct MCEs · 1df73b21
    Borislav Petkov authored
    The severity grading code returns IN_KERNEL_RECOV error context for
    errors which have happened in kernel space but from which the kernel can
    recover. Whether the recovery can happen is determined by the exception
    table entry having as handler ex_handler_fault() and which has been
    declared at build time using _ASM_EXTABLE_FAULT().
    
    IN_KERNEL_RECOV is used in mce_severity_intel() to lookup the
    corresponding error severity in the severities table.
    
    However, the mapping back from error severity to whether the error is
    IN_KERNEL_RECOV is ambiguous and in the very paranoid case - which
    might not be possible right now - but be better safe than sorry later,
    an exception fixup could be attempted for another MCE whose address
    is in the exception table and has the proper severity. Which would be
    unfortunate, to say the least.
    
    Therefore, mark such MCEs explicitly as MCE_IN_KERNEL_RECOV so that the
    recovery attempt is done only for them.
    
    Document the whole handling, while at it, as it is not trivial.
    Reported-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Tested-by: default avatarTony Luck <tony.luck@intel.com>
    Link: https://lkml.kernel.org/r/20200407163414.18058-10-bp@alien8.de
    1df73b21
mce.h 12.4 KB