linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Nadav Amit <nadav.amit@gmail.com>,
	Andy Lutomirski <luto@kernel.org>,
	x86@kernel.org, Borislav Petkov <bp@alien8.de>,
	Rik van Riel <riel@surriel.com>, Jann Horn <jannh@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	stable@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH v2] x86/nmi: Fix some races in NMI uaccess
Date: Thu, 30 Aug 2018 16:27:17 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1808301626500.1210@nanos.tec.linutronix.de> (raw)
In-Reply-To: <A71C1AF9-5C7D-4A04-84CB-4C5FE6D0DA58@amacapital.net>

On Thu, 30 Aug 2018, Andy Lutomirski wrote:
> > On Aug 30, 2018, at 6:36 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> > 
> >> On Wed, 29 Aug 2018, Nadav Amit wrote:
> >> at 8:47 AM, Andy Lutomirski <luto@kernel.org> wrote:
> >> 
> >>> In NMI context, we might be in the middle of context switching or in
> >>> the middle of switch_mm_irqs_off().  In either case, CR3 might not
> >>> match current->mm, which could cause copy_from_user_nmi() and
> >>> friends to read the wrong memory.
> >>> 
> >>> Fix it by adding a new nmi_uaccess_okay() helper and checking it in
> >>> copy_from_user_nmi() and in __copy_from_user_nmi()'s callers.
> >>> 
> >>> Cc: stable@vger.kernel.org
> >>> Cc: Peter Zijlstra <peterz@infradead.org>
> >>> Cc: Nadav Amit <nadav.amit@gmail.com>
> >>> Signed-off-by: Andy Lutomirski <luto@kernel.org>
> >>> ---
> >>> 
> >>> Nadav, this is intended for your series.  Want to add it right
> >>> before the use_temporary_mm() stuff?
> >> 
> >> Sure. Thanks! I will apply the following small fix:
> >> 
> >>> +
> >>> +#ifdef CONFIG_DEBUG_VM
> >>> +    WARN_ON_ONCE(!loaded_mm);
> >>> +#endif
> >> 
> >> Will be changed to VM_WARN_ON_ONCE() in the two instances.
> > 
> > Unless I'm completely lost, this can just be applied to tip right
> > away. It's not depending on anything else.
> > 
> 
> Fine with me. Do you want to do the VM_WARN_ON cleanup yourself or should
> I send a v3?

I think, I'll manage

  reply	other threads:[~2018-08-30 14:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29 15:47 [PATCH v2] x86/nmi: Fix some races in NMI uaccess Andy Lutomirski
2018-08-29 16:06 ` Rik van Riel
2018-08-29 18:56 ` Nadav Amit
2018-08-30 13:36   ` Thomas Gleixner
2018-08-30 14:21     ` Andy Lutomirski
2018-08-30 14:27       ` Thomas Gleixner [this message]
2018-08-30 14:39 ` [tip:x86/urgent] x86/nmi: Fix NMI uaccess race against CR3 switching tip-bot for Andy Lutomirski
2018-08-31 15:13 ` tip-bot for Andy Lutomirski
  -- strict thread matches above, loose matches on Subject: below --
2018-08-27 23:04 [PATCH] x86/nmi: Fix some races in NMI uaccess Andy Lutomirski
2018-08-28 17:56 ` [PATCH v2] " Rik van Riel
2018-08-29  3:46   ` Andy Lutomirski
2018-08-29 15:17     ` Rik van Riel
2018-08-29 15:36       ` Andy Lutomirski
2018-08-29 15:49         ` Rik van Riel
2018-08-29 16:14           ` Andy Lutomirski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.1808301626500.1210@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=bp@alien8.de \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=nadav.amit@gmail.com \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=stable@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).