LKML Archive on
 help / color / Atom feed
From: Borislav Petkov <>
To: X86 ML <>
Cc: LKML <>
Subject: [PATCH 1/2] x86/MCE/AMD: Always give panic severity for UC errors in kernel context
Date: Mon,  6 Nov 2017 18:46:32 +0100
Message-ID: <> (raw)

From: Yazen Ghannam <>

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

Return MCE_PANIC_SEVERITY for all UC errors IN_KERNEL context on AMD


  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 <>
Cc: Tony Luck <>
Cc: linux-edac <>
Cc: x86-ml <>
Fixes: bf80bbd7dcf5 (x86/mce: Add an AMD severities-grading function)
Cc: <> # 4.9.x
Signed-off-by: Borislav Petkov <>
 arch/x86/kernel/cpu/mcheck/mce-severity.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c
index 87cc9ab7a13c..4b8187639c2d 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-severity.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c
@@ -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)
 		 * 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))
 			/* kill current process */
 			return MCE_AR_SEVERITY;
 		} else {

             reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-06 17:46 Borislav Petkov [this message]
2017-11-06 17:46 ` [PATCH 2/2] x86/MCE/AMD: Fix mce_severity_amd_smca() signature Borislav Petkov
2017-11-07 10:16   ` [tip:ras/core] " tip-bot for Yazen Ghannam
2017-11-07 10:15 ` [tip:ras/core] x86/MCE/AMD: Always give panic severity for UC errors in kernel context tip-bot for Yazen Ghannam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git
	git clone --mirror lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone