]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
x86/MCE/AMD: Always give panic severity for UC errors in kernel context
authorYazen Ghannam <yazen.ghannam@amd.com>
Mon, 6 Nov 2017 17:46:32 +0000 (18:46 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 7 Nov 2017 10:07:50 +0000 (11:07 +0100)
The AMD severity grading function was introduced in kernel 4.1. The
current logic can possibly give MCE_AR_SEVERITY for uncorrectable
errors in kernel context. The system may then get stuck in a loop as
memory_failure() will try to handle the bad kernel memory and find it
busy.

Return MCE_PANIC_SEVERITY for all UC errors IN_KERNEL context on AMD
systems.

After:

  b2f9d678e28c ("x86/mce: Check for faults tagged in EXTABLE_CLASS_FAULT exception table entries")

was accepted in v4.6, this issue was masked because of the tail-end attempt
at kernel mode recovery in the #MC handler.

However, uncorrectable errors IN_KERNEL context should always be considered
unrecoverable and cause a panic.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: <stable@vger.kernel.org> # 4.9.x
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Fixes: bf80bbd7dcf5 (x86/mce: Add an AMD severities-grading function)
Link: http://lkml.kernel.org/r/20171106174633.13576-1-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/cpu/mcheck/mce-severity.c

index 87cc9ab7a13cdeb731cd1782a8ea8863aed432a1..4b8187639c2df38fd961e40ac0f4126787cfe096 100644 (file)
@@ -245,6 +245,9 @@ static int mce_severity_amd(struct mce *m, int tolerant, char **msg, bool is_exc
 
        if (m->status & MCI_STATUS_UC) {
 
+               if (ctx == IN_KERNEL)
+                       return MCE_PANIC_SEVERITY;
+
                /*
                 * On older systems where overflow_recov flag is not present, we
                 * should simply panic if an error overflow occurs. If
@@ -255,10 +258,6 @@ static int mce_severity_amd(struct mce *m, int tolerant, char **msg, bool is_exc
                        if (mce_flags.smca)
                                return mce_severity_amd_smca(m, ctx);
 
-                       /* software can try to contain */
-                       if (!(m->mcgstatus & MCG_STATUS_RIPV) && (ctx == IN_KERNEL))
-                               return MCE_PANIC_SEVERITY;
-
                        /* kill current process */
                        return MCE_AR_SEVERITY;
                } else {