From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 01D416B0003 for ; Tue, 7 Aug 2018 15:38:48 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id g26-v6so11053777pfo.7 for ; Tue, 07 Aug 2018 12:38:47 -0700 (PDT) Received: from mail.kernel.org (mail.kernel.org. [198.145.29.99]) by mx.google.com with ESMTPS id t24-v6si1935363pgm.106.2018.08.07.12.38.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Aug 2018 12:38:46 -0700 (PDT) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 3AC3C2174D for ; Tue, 7 Aug 2018 19:38:46 +0000 (UTC) Received: by mail-wr1-f47.google.com with SMTP id u12-v6so16847542wrr.4 for ; Tue, 07 Aug 2018 12:38:46 -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 12:38:24 -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: Dave Hansen Cc: Joerg Roedel , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , X86 ML , LKML , Linux-MM , Linus Torvalds , Andy Lutomirski , 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 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().