From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by kanga.kvack.org (Postfix) with ESMTP id 69EAB6B000A for ; Tue, 7 Aug 2018 16:28:47 -0400 (EDT) Received: by mail-pg1-f199.google.com with SMTP id u4-v6so7712233pgr.2 for ; Tue, 07 Aug 2018 13:28:47 -0700 (PDT) Received: from mail.kernel.org (mail.kernel.org. [198.145.29.99]) by mx.google.com with ESMTPS id h21-v6si2251858pgi.430.2018.08.07.13.28.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Aug 2018 13:28:46 -0700 (PDT) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BCF1F21736 for ; Tue, 7 Aug 2018 20:28:45 +0000 (UTC) Received: by mail-wr1-f51.google.com with SMTP id u12-v6so16960668wrr.4 for ; Tue, 07 Aug 2018 13:28:45 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1533637471-30953-1-git-send-email-joro@8bytes.org> <1533637471-30953-3-git-send-email-joro@8bytes.org> From: Andy Lutomirski Date: Tue, 7 Aug 2018 13:28:23 -0700 Message-ID: Subject: Re: [PATCH 2/3] x86/mm/pti: Don't clear permissions in pti_clone_pmd() Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: To: Thomas Gleixner Cc: Andy Lutomirski , 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, Aug 7, 2018 at 1:21 PM, Thomas Gleixner wrote: > 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. Agreed.