Re: [PATCH 22/43] x86/mm/kaiser: Prepare assembly for entry/exit CR3 switching
From: Thomas Gleixner
Date: Sat Nov 25 2017 - 07:42:05 EST
On Sat, 25 Nov 2017, Thomas Gleixner wrote:
> On Fri, 24 Nov 2017, Ingo Molnar wrote:
> > @@ -1288,6 +1308,8 @@ ENTRY(error_entry)
> > * from user mode due to an IRET fault.
> > */
> > SWAPGS
> > + /* We have user CR3. Change to kernel CR3. */
> > + SWITCH_TO_KERNEL_CR3 scratch_reg=%rax
> >
> > .Lerror_entry_from_usermode_after_swapgs:
> > /* Put us onto the real thread stack. */
> > @@ -1333,6 +1355,7 @@ ENTRY(error_entry)
> > * gsbase and proceed. We'll fix up the exception and land in
> > * .Lgs_change's error handler with kernel gsbase.
> > */
> > + SWITCH_TO_KERNEL_CR3 scratch_reg=%rax
> > SWAPGS
>
> This is wrong. SWAPGS needs to come first.
With this fixed:
Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>