[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZD7gPkfWQeEeEfBe@agluck-desk3.sc.intel.com>
Date: Tue, 18 Apr 2023 11:23:58 -0700
From: Tony Luck <tony.luck@...el.com>
To: Yazen Ghannam <yazen.ghannam@....com>
Cc: Borislav Petkov <bp@...en8.de>, x86@...nel.org,
linux-kernel@...r.kernel.org, linux-edac@...r.kernel.org,
patches@...ts.linux.dev
Subject: Re: [PATCH] x86/mce: Check that memory address is usable for recovery
On Tue, Apr 18, 2023 at 01:51:37PM -0400, Yazen Ghannam wrote:
> I agree. And I think all these checks should be baked into the severity.
> We'll need additional, fine-grained severity levels though.
>
> The "m.cs" and "m.kflags" checks could also be baked in.
>
> Instead of just one AR severity:
> ...
> MCE_AR_SEVERITY,
> MCE_PANIC_SEVERITY,
>
> replace it with specific cases:
> ...
> MCE_AR_USER_RECOV,
> MCE_AR_USER_KILL,
> MCE_AR_KERNEL_COPYIN,
> MCE_AR_KERNEL_RECOV,
> MCE_PANIC_SEVERITY,
>
> Then the #MC handler can look like this:
>
> if (worst < MCE_AR_USER_RECOV)
> goto out;
>
> if (severity == MCE_AR_USER_RECOV)
> queue_task_work(&m, msg, kill_me_maybe);
>
> if (severity == MCE_AR_USER_KILL)
> force_sig(SIGBUS);
>
> if (severity == MCE_AR_KERNEL_COPYIN)
> queue_task_work(&m, msg, kill_me_never);
>
> if (severity == MCE_AR_KERNEL_RECOV) {
> if (!fixup_exception(regs, X86_TRAP_MC, 0, 0))
> mce_panic("Failed kernel mode recovery");
> }
>
> I can take a shot at this if it seems reasonable.
That looks much cleaner. There may be some extra MCE_AR_KERNEL* options
in the future (I'd like someday to address COPYOUT when the corrupt
kernel data is in the page cache). But I don't think the number of cases
is going to explode into dozens of cases.
> What do you think?
Brave person ... you are going to have to tinker with
arch/x86/kernel/cpu/mce/severity.c ! Good luck.
-Tony
Powered by blists - more mailing lists