From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f69.google.com (mail-wm0-f69.google.com [74.125.82.69]) by kanga.kvack.org (Postfix) with ESMTP id 14D8D6B0010 for ; Tue, 7 Aug 2018 16:21:25 -0400 (EDT) Received: by mail-wm0-f69.google.com with SMTP id r14-v6so195016wmh.0 for ; Tue, 07 Aug 2018 13:21:25 -0700 (PDT) Received: from Galois.linutronix.de (Galois.linutronix.de. [2a01:7a0:2:106d:700::1]) by mx.google.com with ESMTPS id z74-v6si2090280wrb.165.2018.08.07.13.21.23 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 07 Aug 2018 13:21:23 -0700 (PDT) Date: Tue, 7 Aug 2018 22:21:03 +0200 (CEST) From: Thomas Gleixner Subject: Re: [PATCH 2/3] x86/mm/pti: Don't clear permissions in pti_clone_pmd() In-Reply-To: Message-ID: References: <1533637471-30953-1-git-send-email-joro@8bytes.org> <1533637471-30953-3-git-send-email-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Andy Lutomirski Cc: Dave Hansen , Joerg Roedel , Ingo Molnar , "H . Peter Anvin" , X86 ML , LKML , Linux-MM , Linus Torvalds , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , "Liguori, Anthony" , Daniel Gruss , Hugh Dickins , Kees Cook , Andrea Arcangeli , Waiman Long , Pavel Machek , "David H . Gutteridge" , Joerg Roedel On Tue, 7 Aug 2018, Andy Lutomirski wrote: > On Tue, Aug 7, 2018 at 11:34 AM, Dave Hansen wrote: > > On 08/07/2018 03:24 AM, Joerg Roedel wrote: > >> The function sets the global-bit on cloned PMD entries, > >> which only makes sense when the permissions are identical > >> between the user and the kernel page-table. > >> > >> Further, only write-permissions are cleared for entry-text > >> and kernel-text sections, which are not writeable anyway. > > > > I think this patch is correct, but I'd be curious if Andy remembers why > > we chose to clear _PAGE_RW on these things. It might have been that we > > were trying to say that the *entry* code shouldn't write to this stuff, > > regardless of whether the normal kernel can. > > > > But, either way, I agree with the logic here that Global pages must > > share permissions between both mappings, so feel free to add my Ack. I > > just want to make sure Andy doesn't remember some detail I'm forgetting. > > I suspect it's because we used to (and maybe still do) initialize the > user tables before mark_read_only(). We still do that because we need the entry stuff working for interrupts early on. We now repeat the clone after mark_ro so the mask RW is not longer required. Thanks, tglx