Re: [PATCH v3] x86/mce: Avoid infinite loop for copy from user recovery

From: Borislav Petkov
Date: Mon Jan 18 2021 - 10:47:59 EST


On Fri, Jan 15, 2021 at 11:34:35AM -0800, Luck, Tony wrote:
> In the user mode case we should only bump mce_count to "1" and
> before task_work() gets called.

Ok, right, it should not be possible to trigger a second MCE while
queue_task_work() runs when it is a user MCE. The handler itself won't
touch the page with the hw error so our assumption is that it'll get
poisoned.

If it doesn't, I guess the memory failure code will kill the process
yadda yadda...

> It shouldn't hurt to do the same checks. Maybe it will catch something
> weird - like an NMI handler on return from the machine check doing a
> get_user() that hits another machine check during the return from this
> machine check.

Eww.

> AndyL has made me extra paranoid. :-)

Yeah, he comes up with the nuttiest scenarios. :-)

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette