From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751683AbdKYMl6 (ORCPT ); Sat, 25 Nov 2017 07:41:58 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:49746 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751532AbdKYMl5 (ORCPT ); Sat, 25 Nov 2017 07:41:57 -0500 Date: Sat, 25 Nov 2017 13:41:54 +0100 (CET) From: Thomas Gleixner To: Ingo Molnar cc: linux-kernel@vger.kernel.org, Dave Hansen , Andy Lutomirski , "H . Peter Anvin" , Peter Zijlstra , Borislav Petkov , Linus Torvalds Subject: Re: [PATCH 22/43] x86/mm/kaiser: Prepare assembly for entry/exit CR3 switching In-Reply-To: Message-ID: References: <20171124172411.19476-1-mingo@kernel.org> <20171124172411.19476-23-mingo@kernel.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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