From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f199.google.com (mail-wr0-f199.google.com [209.85.128.199]) by kanga.kvack.org (Postfix) with ESMTP id 7474A6B0253 for ; Tue, 12 Dec 2017 14:21:55 -0500 (EST) Received: by mail-wr0-f199.google.com with SMTP id v69so12852815wrb.3 for ; Tue, 12 Dec 2017 11:21:55 -0800 (PST) Received: from Galois.linutronix.de (Galois.linutronix.de. [2a01:7a0:2:106d:700::1]) by mx.google.com with ESMTPS id r136si165682wmf.262.2017.12.12.11.21.53 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 12 Dec 2017 11:21:53 -0800 (PST) Date: Tue, 12 Dec 2017 20:21:22 +0100 (CET) From: Thomas Gleixner Subject: Re: [patch 13/16] x86/ldt: Introduce LDT write fault handler In-Reply-To: Message-ID: References: <20171212173221.496222173@linutronix.de> <20171212173334.345422294@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Linus Torvalds Cc: LKML , the arch/x86 maintainers , Andy Lutomirsky , Peter Zijlstra , Dave Hansen , Borislav Petkov , Greg KH , Kees Cook , Hugh Dickins , Brian Gerst , Josh Poimboeuf , Denys Vlasenko , Boris Ostrovsky , Juergen Gross , David Laight , Eduardo Valentin , "Liguori, Anthony" , Will Deacon , linux-mm On Tue, 12 Dec 2017, Linus Torvalds wrote: > On Tue, Dec 12, 2017 at 9:32 AM, Thomas Gleixner wrote: > > From: Thomas Gleixner > > > > When the LDT is mapped RO, the CPU will write fault the first time it uses > > a segment descriptor in order to set the ACCESS bit (for some reason it > > doesn't always observe that it already preset). Catch the fault and set the > > ACCESS bit in the handler. > > This really scares me. > > We use segments in some critical code in the kernel, like the whole > percpu data etc. Stuff that definitely shouldn't fault. > > Yes, those segments should damn well be already marked accessed when > the segment is loaded, but apparently that isn't reliable. That has nothing to do with the user installed LDT. The kernel does not use and rely on LDT at all. The only critical interaction is the return to user path (user CS/SS) and we made sure with the LAR touching that these are precached in the CPU before we go into fragile exit code. Luto has some concerns vs. load_gs[_index] and we'll certainly look into that some more. Thanks, tglx -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org