Re: [PATCH v2] x86/nmi: Fix some races in NMI uaccess

2018-08-30 Thread Thomas Gleixner
On Thu, 30 Aug 2018, Andy Lutomirski wrote: > > On Aug 30, 2018, at 6:36 AM, Thomas Gleixner wrote: > > > >> On Wed, 29 Aug 2018, Nadav Amit wrote: > >> at 8:47 AM, Andy Lutomirski wrote: > >> > >>> In NMI context, we might be in the middle of context switching or in > >>> the middle of switch_

Re: [PATCH v2] x86/nmi: Fix some races in NMI uaccess

2018-08-30 Thread Andy Lutomirski
> On Aug 30, 2018, at 6:36 AM, Thomas Gleixner wrote: > >> On Wed, 29 Aug 2018, Nadav Amit wrote: >> at 8:47 AM, Andy Lutomirski 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

Re: [PATCH v2] x86/nmi: Fix some races in NMI uaccess

2018-08-30 Thread Thomas Gleixner
On Wed, 29 Aug 2018, Nadav Amit wrote: > at 8:47 AM, Andy Lutomirski 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 > > frien

Re: [PATCH v2] x86/nmi: Fix some races in NMI uaccess

2018-08-29 Thread Nadav Amit
at 8:47 AM, Andy Lutomirski 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

Re: [PATCH v2] x86/nmi: Fix some races in NMI uaccess

2018-08-29 Thread Andy Lutomirski
On Wed, Aug 29, 2018 at 8:49 AM, Rik van Riel wrote: > On Wed, 2018-08-29 at 08:36 -0700, Andy Lutomirski wrote: >> On Wed, Aug 29, 2018 at 8:17 AM, Rik van Riel >> wrote: >> > On Tue, 2018-08-28 at 20:46 -0700, Andy Lutomirski wrote: >> > > On Tue, Aug 28, 2018 at 10:56 AM, Rik van Riel >> > >

Re: [PATCH v2] x86/nmi: Fix some races in NMI uaccess

2018-08-29 Thread Rik van Riel
On Wed, 2018-08-29 at 08:47 -0700, Andy Lutomirski 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. >

Re: [PATCH v2] x86/nmi: Fix some races in NMI uaccess

2018-08-29 Thread Rik van Riel
On Wed, 2018-08-29 at 08:36 -0700, Andy Lutomirski wrote: > On Wed, Aug 29, 2018 at 8:17 AM, Rik van Riel > wrote: > > On Tue, 2018-08-28 at 20:46 -0700, Andy Lutomirski wrote: > > > On Tue, Aug 28, 2018 at 10:56 AM, Rik van Riel > > > wrote: > > > > On Mon, 27 Aug 2018 16:04:16 -0700 > > > > And

[PATCH v2] x86/nmi: Fix some races in NMI uaccess

2018-08-29 Thread Andy Lutomirski
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 i

Re: [PATCH v2] x86/nmi: Fix some races in NMI uaccess

2018-08-29 Thread Andy Lutomirski
On Wed, Aug 29, 2018 at 8:17 AM, Rik van Riel wrote: > On Tue, 2018-08-28 at 20:46 -0700, Andy Lutomirski wrote: >> On Tue, Aug 28, 2018 at 10:56 AM, Rik van Riel >> wrote: >> > On Mon, 27 Aug 2018 16:04:16 -0700 >> > Andy Lutomirski wrote: >> > >> > > The 0day bot is still chewing on this, but

Re: [PATCH v2] x86/nmi: Fix some races in NMI uaccess

2018-08-29 Thread Rik van Riel
On Tue, 2018-08-28 at 20:46 -0700, Andy Lutomirski wrote: > On Tue, Aug 28, 2018 at 10:56 AM, Rik van Riel > wrote: > > On Mon, 27 Aug 2018 16:04:16 -0700 > > Andy Lutomirski wrote: > > > > > The 0day bot is still chewing on this, but I've tested it a bit > > > locally > > > and it seems to do t

Re: [PATCH v2] x86/nmi: Fix some races in NMI uaccess

2018-08-28 Thread Andy Lutomirski
On Tue, Aug 28, 2018 at 10:56 AM, Rik van Riel wrote: > On Mon, 27 Aug 2018 16:04:16 -0700 > Andy Lutomirski 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 bu

[PATCH v2] x86/nmi: Fix some races in NMI uaccess

2018-08-28 Thread Rik van Riel
On Mon, 27 Aug 2018 16:04:16 -0700 Andy Lutomirski 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