x86/extable: Provide EX_TYPE_DEFAULT_MCE_SAFE and EX_TYPE_FAULT_MCE_SAFE
authorThomas Gleixner <tglx@linutronix.de>
Wed, 8 Sep 2021 13:29:19 +0000 (15:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jul 2022 15:25:25 +0000 (17:25 +0200)
[ Upstream commit 2cadf5248b9316d3c8af876e795d61c55476f6e9 ]

Provide exception fixup types which can be used to identify fixups which
allow in kernel #MC recovery and make them invoke the existing handlers.

These will be used at places where #MC recovery is handled correctly by the
caller.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210908132525.269689153@linutronix.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/include/asm/extable_fixup_types.h
arch/x86/kernel/cpu/mce/severity.c
arch/x86/mm/extable.c

index 0adc117618e6ee17e9ce4f1feba79ce1df478307..409524d5d2eb1f4b14507f2c221bfe640f78c5cd 100644 (file)
@@ -16,4 +16,7 @@
 #define        EX_TYPE_WRMSR_IN_MCE            10
 #define        EX_TYPE_RDMSR_IN_MCE            11
 
+#define        EX_TYPE_DEFAULT_MCE_SAFE        12
+#define        EX_TYPE_FAULT_MCE_SAFE          13
+
 #endif
index 74fe763bffdab29eec8b5230619f61acfc1e8ff5..d9b77a74f8d2e3100793a69b6bbead1c813e7c03 100644 (file)
@@ -278,6 +278,8 @@ static int error_context(struct mce *m, struct pt_regs *regs)
                m->kflags |= MCE_IN_KERNEL_COPYIN;
                fallthrough;
        case EX_TYPE_FAULT:
+       case EX_TYPE_FAULT_MCE_SAFE:
+       case EX_TYPE_DEFAULT_MCE_SAFE:
                m->kflags |= MCE_IN_KERNEL_RECOV;
                return IN_KERNEL_RECOV;
        default:
index 5db46df409b50db6e469fff5c230c2ced5f56a02..f37e290e6d0ab4a19dfeb5a533f5e337a99a38f2 100644 (file)
@@ -131,8 +131,10 @@ int fixup_exception(struct pt_regs *regs, int trapnr, unsigned long error_code,
 
        switch (e->type) {
        case EX_TYPE_DEFAULT:
+       case EX_TYPE_DEFAULT_MCE_SAFE:
                return ex_handler_default(e, regs);
        case EX_TYPE_FAULT:
+       case EX_TYPE_FAULT_MCE_SAFE:
                return ex_handler_fault(e, regs, trapnr);
        case EX_TYPE_UACCESS:
                return ex_handler_uaccess(e, regs, trapnr);