linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aili Yao <yaoaili@kingsoft.com>
To: <tony.luck@intel.com>, <bp@alien8.de>, <mingo@redhat.com>,
	<yangfeng1@kingsoft.com>, <yaoaili@kingsoft.com>
Cc: <tglx@linutronix.de>, <x86@kernel.org>, <hpa@zytor.com>,
	<linux-edac@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: x86/mce: fix wrong no-return-ip logic in do_machine_check()
Date: Mon, 22 Feb 2021 11:31:24 +0800	[thread overview]
Message-ID: <20210222113124.35f2d552@alex-virtual-machine> (raw)

From commit b2f9d678e28c ("x86/mce: Check for faults tagged in
EXTABLE_CLASS_FAULT exception table entries"), When there is a
memory MCE_AR_SEVERITY error with no return ip, Only a SIGBUS
signal is send to current. As the page is not poisoned, the SIGBUS
process coredump step in kernel will touch the error page again,
whick result to a fatal error. We need to poison the page and then
kill current in memory-failure module.

So fix it using the orinigal checking method.

Signed-off-by: Aili Yao <yaoaili@kingsoft.com>
---
 arch/x86/kernel/cpu/mce/core.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index e133ce1e562b..ae09b0279422 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -1413,9 +1413,10 @@ noinstr void do_machine_check(struct pt_regs *regs)
 	if ((m.cs & 3) == 3) {
 		/* If this triggers there is no way to recover. Die hard. */
 		BUG_ON(!on_thread_stack() || !user_mode(regs));
-
-		queue_task_work(&m, kill_current_task);
-
+		if (worst == MCE_AR_SEVERITY)
+			queue_task_work(&m, 0);
+		else if (kill_current_task)
+			queue_task_work(&m, kill_current_task);
 	} else {
 		/*
 		 * Handle an MCE which has happened in kernel space but from
-- 
2.25.1


             reply	other threads:[~2021-02-22  3:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-22  3:31 Aili Yao [this message]
2021-02-22  3:50 ` [PATCH v2] x86/mce: fix wrong no-return-ip logic in do_machine_check() Aili Yao
2021-02-22  9:24   ` Borislav Petkov
2021-02-22  9:31     ` Aili Yao
2021-02-22 10:03       ` Borislav Petkov
2021-02-22 10:08         ` Aili Yao
2021-02-22 10:22           ` Borislav Petkov
2021-02-22 11:21             ` Aili Yao
2021-02-22 12:17               ` Aili Yao
2021-02-22 12:22                 ` Borislav Petkov
2021-02-22 12:35                   ` Aili Yao
2021-02-22 12:45                     ` Borislav Petkov
2021-02-23  2:27                       ` Aili Yao
2021-02-23  9:43                         ` Borislav Petkov
2021-02-23  9:56                           ` Aili Yao
2021-02-23 10:05                             ` Borislav Petkov
2021-02-23 11:27                               ` Aili Yao
2021-02-23 16:12                                 ` Luck, Tony
2021-02-24  2:39                                   ` Aili Yao
2021-03-24  2:59                                     ` Aili Yao
2021-03-24  8:03                                       ` Aili Yao

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20210222113124.35f2d552@alex-virtual-machine \
    --to=yaoaili@kingsoft.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --cc=yangfeng1@kingsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).