mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/mce: Always call kill_me_maybe() to handle memory failure in user mode
@ 2022-01-24  8:15 luofei
  2022-01-24  9:47 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: luofei @ 2022-01-24  8:15 UTC (permalink / raw)
  To: tony.luck, bp, tglx, mingo, dave.hansen, x86
  Cc: hpa, linux-edac, linux-kernel, luofei

Just killing the current process is not enough, it is necessory
to offload the faulty page.

In the virtualization scenario, qemu does not set MCG_STATUS_RIPV by
default. When injecting an SRAR error into the virtual machine, only
the current process will be killed, but the faulty page will be
released and reused, which is very likely to cause the virtual
machine to crash.

Signed-off-by: luofei <luofei@unicloud.com>
---
 arch/x86/kernel/cpu/mce/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 5818b837fd4d..bc6c353b9250 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -1519,10 +1519,8 @@ noinstr void do_machine_check(struct pt_regs *regs)
 		BUG_ON(!on_thread_stack() || !user_mode(regs));
 
 		if (kill_current_task)
-			queue_task_work(&m, msg, kill_me_now);
-		else
-			queue_task_work(&m, msg, kill_me_maybe);
-
+			force_sig(SIGBUS);
+		queue_task_work(&m, msg, kill_me_maybe);
 	} else {
 		/*
 		 * Handle an MCE which has happened in kernel space but from
-- 
2.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-24  9:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-24  8:15 [PATCH] x86/mce: Always call kill_me_maybe() to handle memory failure in user mode luofei
2022-01-24  9:47 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®