From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752981AbdK2Odl (ORCPT ); Wed, 29 Nov 2017 09:33:41 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:40638 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751077AbdK2Odj (ORCPT ); Wed, 29 Nov 2017 09:33:39 -0500 X-Google-Smtp-Source: AGs4zMbKJyAKyXJzORgnZbQoFRYKVyz71/V2o44ApXktXnlZzo9h/DgMIiYn4z2aGr+xycUW4/Unmg== Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled From: Andy Lutomirski X-Mailer: iPhone Mail (15B150) In-Reply-To: <20171129124711.slmq5emx4f26c4zp@hirez.programming.kicks-ass.net> Date: Wed, 29 Nov 2017 06:33:37 -0800 Cc: Ingo Molnar , Jarkko Nikula , linux-kernel , Andy Lutomirski , Thomas Gleixner , Linus Torvalds , Borislav Petkov Message-Id: References: <0fede9f9-88b0-a6e7-1027-dfb2019b8ef2@linux.intel.com> <20171129070951.hjjjpbyilzaak4ig@gmail.com> <20171129124711.slmq5emx4f26c4zp@hirez.programming.kicks-ass.net> To: Peter Zijlstra Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id vATEXj7n022479 > On Nov 29, 2017, at 4:47 AM, Peter Zijlstra wrote: > >> On Wed, Nov 29, 2017 at 08:09:51AM +0100, Ingo Molnar wrote: >> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S >> index f81d50d7ceac..c0b52df8ee4f 100644 >> --- a/arch/x86/entry/entry_64.S >> +++ b/arch/x86/entry/entry_64.S >> @@ -945,16 +945,16 @@ idtentry simd_coprocessor_error do_simd_coprocessor_error has_error_code=0 >> */ >> ENTRY(native_load_gs_index) >> FRAME_BEGIN >> + SWAPGS /* switch from user GS to kernel GS */ >> pushfq >> DISABLE_INTERRUPTS(CLBR_ANY & ~CLBR_RDI) >> TRACE_IRQS_OFF >> - SWAPGS > > I'm thinking those moves it too far back; we should at least have > interrupts disabled when we do SWAPGS, no? Also, curse paravirt. > I'll look in a few hours. But we definitely can't have irqs on when running with user gs.