From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 8D1FB6B0007 for ; Thu, 9 Aug 2018 07:16:08 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id z20-v6so1990806edq.10 for ; Thu, 09 Aug 2018 04:16:08 -0700 (PDT) Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id d4-v6si2516876edl.365.2018.08.09.04.16.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 04:16:07 -0700 (PDT) Date: Thu, 9 Aug 2018 13:16:03 +0200 From: Joerg Roedel Subject: Re: [PATCH] x86/mm/pti: Move user W+X check into pti_finalize() Message-ID: <20180809111603.aqon7xqmanvoycbu@suse.de> References: <1533727000-9172-1-git-send-email-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Dave Hansen Cc: Joerg Roedel , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, 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 , aliguori@amazon.com, daniel.gruss@iaik.tugraz.at, hughd@google.com, keescook@google.com, Andrea Arcangeli , Waiman Long , Pavel Machek , "David H . Gutteridge" Hi Dave, On Wed, Aug 08, 2018 at 08:54:37AM -0700, Dave Hansen wrote: > One bit of information missing from the changelog: Could you clarify how > there are any entries in the user page tables for the code to complain? > Before pti_init(), I would have expected the user page tables to be empty. The W+X check runs at the end of mark_readonly() in x86, which is after pti_init() already put kernel mappings into the user page-table. Problem is that the cloned entries are still W+X mapped, which is fixed in pti_finalize() running _after_ mark_readonly(). Regards, Joerg