Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752368AbdLLSl5 (ORCPT ); Tue, 12 Dec 2017 13:41:57 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:34249 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751612AbdLLSl4 (ORCPT ); Tue, 12 Dec 2017 13:41:56 -0500 Date: Tue, 12 Dec 2017 19:41:39 +0100 (CET) From: Thomas Gleixner To: Peter Zijlstra cc: Andy Lutomirski , Andy Lutomirski , LKML , X86 ML , Linus Torvalds , Dave Hansen , Borislav Petkov , Greg KH , Kees Cook , Hugh Dickins , Brian Gerst , Josh Poimboeuf , Denys Vlasenko , Boris Ostrovsky , Juergen Gross , David Laight , Eduardo Valentin , aliguori@amazon.com, Will Deacon , "linux-mm@kvack.org" Subject: Re: [patch 11/16] x86/ldt: Force access bit for CS/SS In-Reply-To: <20171212182906.cg635muwcdnh6p66@hirez.programming.kicks-ass.net> Message-ID: References: <20171212173221.496222173@linutronix.de> <20171212173334.176469949@linutronix.de> <20171212180918.lc5fdk5jyzwmrcxq@hirez.programming.kicks-ass.net> <20171212182906.cg635muwcdnh6p66@hirez.programming.kicks-ass.net> 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 Content-Length: 1172 Lines: 34 On Tue, 12 Dec 2017, Peter Zijlstra wrote: > On Tue, Dec 12, 2017 at 10:22:48AM -0800, Andy Lutomirski wrote: > > > > Also, why is LAR deferred to user exit? And I thought that LAR didn't > > set the accessed bit. > > LAR does not set the ACCESSED bit indeed, we need to explicitly set that > when creating the descriptor. > > It also works if you do the LAR right after LLDT (which is what I > originally had). The reason its a TIF flag is that I originally LAR'ed > every entry in the table. > > It got reduced to CS/SS, but the TIF thing stayed. > > > If I had to guess, I'd guess that LAR is actually generating a read > > fault and forcing the pagetables to get populated. If so, then it > > means the VMA code isn't quite right, or you're susceptible to > > failures under memory pressure. > > > > Now maybe LAR will repopulate the PTE every time if you were to never > > clear it, but ick. > > I did not observe #PFs from LAR, we had a giant pile of trace_printk() > in there. The pages are populated _before_ the new ldt is installed. So no memory pressure issue, nothing. If the populate fails, then modify_ldt() returns with an error. Thanks, tglx