From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751824AbdKYRDm (ORCPT ); Sat, 25 Nov 2017 12:03:42 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:50062 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751591AbdKYRDl (ORCPT ); Sat, 25 Nov 2017 12:03:41 -0500 Date: Sat, 25 Nov 2017 18:03:36 +0100 (CET) From: Thomas Gleixner To: Andy Lutomirski cc: Borislav Petkov , Ingo Molnar , linux-kernel@vger.kernel.org, Dave Hansen , "H . Peter Anvin" , Peter Zijlstra , Linus Torvalds Subject: Re: [PATCH 20/43] x86/entry: Clean up SYSENTER_stack code In-Reply-To: Message-ID: References: <20171124172411.19476-1-mingo@kernel.org> <20171124172411.19476-21-mingo@kernel.org> <20171125163956.nrxpobf5xetnavo6@pd.tnic> 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, Andy Lutomirski wrote: > > On Nov 25, 2017, at 9:50 AM, Thomas Gleixner wrote: > > > > On Sat, 25 Nov 2017, Borislav Petkov wrote: > >>> - > >>> + wrmsr(MSR_IA32_SYSENTER_ESP, (unsigned long)(cpu_SYSENTER_stack(cpu) + 1), 0); > >>> wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long)entry_SYSENTER_32, 0); > >> > >> Right, so we have now two TSS thingies, AFAICT: > >> > >> tss = &per_cpu(cpu_tss, cpu); > >> > >> which is cpu_tss and then indirectly, we have also: > >> > >> &get_cpu_entry_area((cpu))->tss > >> > >> And those are two different things in my guest here: > >> > >> [ 0.044002] tss: 0xf5747000 > >> [ 0.044706] entry area tss: 0xffef1000 > >> > >> What is the logic here? We carry two TSSs per CPU - one which is RO > >> for the entry area and the other is the actual cpu_tss thing? Or am I > >> misreading it? > > > > entry area tss is a alias mapping of cpu_tss > > > > + set_percpu_fixmap_pages(get_cpu_entry_area_index(cpu, tss), > > + &per_cpu(cpu_tss, cpu), > > + sizeof(struct tss_struct) / PAGE_SIZE, > > + PAGE_KERNEL); > > > > Exactly. And, in the patch I haven't emailed, the alias is RO on x86_64. Btw, I don't think you have to worry about making it RO. The SDM is blurry about that for 64bit. RW is a must for 32bit though. > Maybe I should rename cpu_tss to cpu_tss_rw in that patch. For clarity that would be nice. Thanks, tglx