Re: [PATCH v2] x86/nmi: Fix some races in NMI uaccess
From: Andy Lutomirski
Date: Tue Aug 28 2018 - 23:47:02 EST
On Tue, Aug 28, 2018 at 10:56 AM, Rik van Riel <riel@xxxxxxxxxxx> wrote:
> On Mon, 27 Aug 2018 16:04:16 -0700
> Andy Lutomirski <luto@xxxxxxxxxx> wrote:
>> The 0day bot is still chewing on this, but I've tested it a bit locally
>> and it seems to do the right thing.
> Hi Andy,
> the version of the patch below should fix the bug we talked about
> in email yesterday. It should automatically cover kernel threads
> in lazy TLB mode, because current->mm will be NULL, while the
> cpu_tlbstate.loaded_mm should never be NULL.
That's better than mine. I tweaked it a bit and added some debugging,
and I got this:
I made the loaded_mm handling a little more conservative to make it
more obvious that switch_mm_irqs_off() is safe regardless of exactly
when it gets called relative to switching current.