Re: [PATCH] x86/nmi: Fix some races in NMI uaccess
From: Rik van Riel
Date: Tue Aug 28 2018 - 09:51:05 EST
On Mon, 2018-08-27 at 19:10 -0700, Andy Lutomirski wrote:
> On Mon, Aug 27, 2018 at 6:31 PM, Rik van Riel <riel@xxxxxxxxxxx>
> wrote:
>
> > What is special about this path wrt nmi_uaccess_ok that is
> > not also true for the need_flush branch right above it?
> >
> > What am I missing?
>
> Nothing. My patch is buggy. ETOLITTLESLEEP.
>
> I could drop this part of the patch entirely. Or I could drop the
> loaded_mm->pgd == __va(read_cr3_pa() check and instead make sure that
> loaded_mm is NULL at any point at which loaded_mm might not match
> CR3.
> The latter will be faster in any (hypothetical) virtualization
> environment where CR3 reads trap. I don't know if we have any such
> cases where perf works and we care about performance, though.
Moving that loaded_mm = NULL assignment up a few
lines, so it comes before the "if (need_flush)"
test and covers both branches should cover that,
indeed.
--
All Rights Reversed.
Attachment:
signature.asc
Description: This is a digitally signed message part