[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1711241404340.1757@nanos>
Date: Fri, 24 Nov 2017 14:04:45 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: Peter Zijlstra <peterz@...radead.org>
cc: Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...capital.net>,
"H . Peter Anvin" <hpa@...or.com>, Borislav Petkov <bp@...en8.de>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 22/43] x86/mm/kaiser: Prepare assembly for entry/exit
CR3 switching
On Fri, 24 Nov 2017, Peter Zijlstra wrote:
> On Fri, Nov 24, 2017 at 01:17:06PM +0100, Ingo Molnar wrote:
> >
> > * Peter Zijlstra <peterz@...radead.org> wrote:
> >
> > > On Fri, Nov 24, 2017 at 10:14:27AM +0100, Ingo Molnar wrote:
> > > > @@ -1343,9 +1373,10 @@ ENTRY(error_entry)
> > > >
> > > > .Lerror_bad_iret:
> > > > /*
> > > > + * We came from an IRET to user mode, so we have user
> > > > + * gsbase and CR3. Switch to kernel gsbase and CR3:
> > > > */
> > > > + SWITCH_TO_KERNEL_CR3 scratch_reg=%rax
> > > > SWAPGS
> > > >
> > > > /*
> > >
> > > The Changelog states SWAPGS must be done before, yet the code does
> > > after.
> >
> > Yes, so this is the SWAPGS that is done before we go back to user-space.
>
> The comment there clearly states we have user gs and we need to switch
> to kernel gs. The Changelog states we should switch gs before cr3.
>
> So either the comment or the code needs fixing.
The code :)
Powered by blists - more mailing lists