Received: by 10.223.148.5 with SMTP id 5csp6568716wrq; Wed, 17 Jan 2018 15:44:37 -0800 (PST) X-Google-Smtp-Source: ACJfBouW0tWPN6YJmio3NhsNNZJVe7MBGCkgLOomBKqL5SsvyQlJ9lvyqum/DX+dV3jx2P+4B9sr X-Received: by 10.99.37.129 with SMTP id l123mr20770886pgl.242.1516232677141; Wed, 17 Jan 2018 15:44:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516232677; cv=none; d=google.com; s=arc-20160816; b=ZfatHkogWrj3shDNJBfgPFhi9Ub7/sxTWURigqoW3qlipCpwgMefyGwzReN47n6GoP FupSmqsGx3rb8d0goZNgtKlRAJUedu+N2m3EiFIg+wFfOpJoiQl3p5kHpbkL1IKA4/5D 5sVgygAgo+w11TfOVusjGK/IBSZmYYyTxhSWggCfgBH5j3o/tAjkLnetRLXNNyE4fdk8 bY4hF5Jt1NIk2cA/xXqUVN/yZywenGuwgBoiAdWMkYWes+sToNT2VPTKkkDEetf2f7cp tcgxAta2xP/H3nSM48Dgg5jzVA9RExOT1ht4g4zrqOlVe7Cx9YHsyzNfdXTonBNNYSUU oHZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dmarc-filter :arc-authentication-results; bh=WDsJtGKpjTWfgGqwJlIXFOmu5jIXo4+f2t9jMll8Q7Y=; b=eqW7Sxwwr5qC+rJwC3ADI9/N8drAaxDl4d6APt08BvPmQ24CnG2KjO3yj10oaUsP8O P7co/EtGdyTccqwy1UzksGBqFCGvkInAQNkRmNH5B2u6YslIJ2EWHpSs2ZWZvBXmkfKK CTHIdy1WXJm3vKGQWsmjpGGFdfRBhJJTHYL63cLo48JBq3ut+4uJ1D0UdYTmVkD1mIcb x0y+G65/YXldOfG7wMr9nxRl3rA1KsA4GvDUbGXV3PrjM57LTWzkWBkJvX7awdM06ubp Wu/e8A4vkFoee+p7vY/+K50Vlrw5LYkcNYZ8Rb+QdqXtaX0x40PZwFpUKUH+nkw7jxS7 2WhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p64si4611839pga.821.2018.01.17.15.44.22; Wed, 17 Jan 2018 15:44:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754392AbeAQXng (ORCPT + 99 others); Wed, 17 Jan 2018 18:43:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:60346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753662AbeAQXnf (ORCPT ); Wed, 17 Jan 2018 18:43:35 -0500 Received: from mail-it0-f53.google.com (mail-it0-f53.google.com [209.85.214.53]) (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 EE7342175B for ; Wed, 17 Jan 2018 23:43:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE7342175B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org Received: by mail-it0-f53.google.com with SMTP id b5so11328616itc.3 for ; Wed, 17 Jan 2018 15:43:34 -0800 (PST) X-Gm-Message-State: AKwxytfcp4p9rniW5Mq7f85aQ4g4+oBiB38be+tZ+Kx31bu/qjWJic/h PxWlKeERVQSWkvwvr1wbNecTTOUMlEuPS5y6PtmmFA== X-Received: by 10.36.228.71 with SMTP id o68mr21784744ith.132.1516232614388; Wed, 17 Jan 2018 15:43:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.152.114 with HTTP; Wed, 17 Jan 2018 15:43:14 -0800 (PST) In-Reply-To: <1516120619-1159-9-git-send-email-joro@8bytes.org> References: <1516120619-1159-1-git-send-email-joro@8bytes.org> <1516120619-1159-9-git-send-email-joro@8bytes.org> From: Andy Lutomirski Date: Wed, 17 Jan 2018 15:43:14 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 08/16] x86/pgtable/32: Allocate 8k page-tables when PTI is enabled To: Joerg Roedel Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , X86 ML , LKML , Linux-MM , Linus Torvalds , Andy Lutomirski , Dave Hansen , 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 , Joerg Roedel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 16, 2018 at 8:36 AM, Joerg Roedel wrote: > From: Joerg Roedel > > Allocate a kernel and a user page-table root when PTI is > enabled. Also allocate a full page per root for PAEm because > otherwise the bit to flip in cr3 to switch between them > would be non-constant, which creates a lot of hassle. > Keep that for a later optimization. > > Signed-off-by: Joerg Roedel > --- > arch/x86/kernel/head_32.S | 23 ++++++++++++++++++----- > arch/x86/mm/pgtable.c | 11 ++++++----- > 2 files changed, 24 insertions(+), 10 deletions(-) > > diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S > index c29020907886..fc550559bf58 100644 > --- a/arch/x86/kernel/head_32.S > +++ b/arch/x86/kernel/head_32.S > @@ -512,28 +512,41 @@ ENTRY(initial_code) > ENTRY(setup_once_ref) > .long setup_once > > +#ifdef CONFIG_PAGE_TABLE_ISOLATION > +#define PGD_ALIGN (2 * PAGE_SIZE) > +#define PTI_USER_PGD_FILL 1024 > +#else > +#define PGD_ALIGN (PAGE_SIZE) > +#define PTI_USER_PGD_FILL 0 > +#endif > /* > * BSS section > */ > __PAGE_ALIGNED_BSS > - .align PAGE_SIZE > + .align PGD_ALIGN > #ifdef CONFIG_X86_PAE > .globl initial_pg_pmd > initial_pg_pmd: > .fill 1024*KPMDS,4,0 > + .fill PTI_USER_PGD_FILL,4,0 Couldn't this be simplified to just .align PGD_ALIGN, 0 without the .fill?