Received: by 10.223.176.5 with SMTP id f5csp716802wra; Fri, 9 Feb 2018 06:09:11 -0800 (PST) X-Google-Smtp-Source: AH8x225VRfivWnTlJL/JAgsP2/naOKG2j2ez5lO8nP5damvv2DT8VbOx+YKNPJr+mKoryvmS+gdf X-Received: by 10.98.15.15 with SMTP id x15mr3039626pfi.197.1518185350901; Fri, 09 Feb 2018 06:09:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518185350; cv=none; d=google.com; s=arc-20160816; b=eWpwWd+GwsFPhXMXjRyWAhUCHJ3EJvxItxCC3D13NZ0VjHAVVqBP3+WCyyJzuh0O5P mFZRziSmWr5WlnODwKACi1uCRIM71308eaIhhe6y1FzgNMtyj/afNm6CE8eamPBI03cn OURibiTeCvzqiZvMZjuVBiKnUbfA7cRrDPD7/3vaWjTFvmC+8shpIDteNf/7k2qM3VSS IN88Z4FZTsZtvvmNRozicun5EzyKAPRq6H1ekAN62KYjOFP/uZUlJjUNHhNBfRRK8Z47 RMgtiVs+ayy0IUWulp4Yio+R38yGypMAVLmNtKwoU8gWxqYLx/V7YvIdB8Qdp3PWuV6e H4ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=qw4wQuyyf6TTy+vXkeyS2h+5xE3jMh1IDEw2yEmpRU8=; b=SIUzHW2OEUBk/Mze0/hzADiK4bCDOnbwgnsaNsgVpmsg3gFV8/KU+aBQls9fQ+J3+7 EOKpHaTqON2/dCHjVJCyzRN/yQmfJbwnhVFebR+R41Hm5xMUJRAQ8b74nMEYb52K8H2z C9JadBgpwq8842cvmlH/AikhlAfi9gGi/2DZLT7v6mUbehBNeYFjJSfT+pLq74v3f8py YM3e/ISftzEzTr6O3c6hn8SJvw5CZn0uE/S3Kj3pGDrpPNIDriGPOUSAfEUULeH70CIi gFGTvMZBJtqgZLAvqUL8Ott1O/o9pNGdZXoUITsz4ziR6e7fRamA/UNNyOwv793JI6aY V0Ng== 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 99-v6si1607300plf.440.2018.02.09.06.08.51; Fri, 09 Feb 2018 06:09:10 -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 S1753002AbeBINmj (ORCPT + 99 others); Fri, 9 Feb 2018 08:42:39 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:49920 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752978AbeBINmh (ORCPT ); Fri, 9 Feb 2018 08:42:37 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7929CFB6; Fri, 9 Feb 2018 13:42:36 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Tatashin , Steven Sistare , Jiri Kosina , Hugh Dickins Subject: [PATCH 4.9 17/92] kaiser: allocate pgd with order 0 when pti=off Date: Fri, 9 Feb 2018 14:38:46 +0100 Message-Id: <20180209133932.516958922@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180209133931.211869118@linuxfoundation.org> References: <20180209133931.211869118@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 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 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hugh Dickins The 4.9.77 version of "x86/pti/efi: broken conversion from efi to kernel page table" looked nicer than the 4.4.112 version, but was suboptimal on machines booted with "pti=off" (or on AMD machines): it allocated pgd with an order 1 page whatever the setting of kaiser_enabled. Fix that by moving the definition of PGD_ALLOCATION_ORDER from asm/pgalloc.h to asm/pgtable.h, which already defines kaiser_enabled. Fixes: 1b92c48a2eeb ("x86/pti/efi: broken conversion from efi to kernel page table") Reviewed-by: Pavel Tatashin Cc: Steven Sistare Cc: Jiri Kosina Signed-off-by: Hugh Dickins Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/pgalloc.h | 11 ----------- arch/x86/include/asm/pgtable.h | 6 ++++++ 2 files changed, 6 insertions(+), 11 deletions(-) --- a/arch/x86/include/asm/pgalloc.h +++ b/arch/x86/include/asm/pgalloc.h @@ -27,17 +27,6 @@ static inline void paravirt_release_pud( */ extern gfp_t __userpte_alloc_gfp; -#ifdef CONFIG_PAGE_TABLE_ISOLATION -/* - * Instead of one PGD, we acquire two PGDs. Being order-1, it is - * both 8k in size and 8k-aligned. That lets us just flip bit 12 - * in a pointer to swap between the two 4k halves. - */ -#define PGD_ALLOCATION_ORDER 1 -#else -#define PGD_ALLOCATION_ORDER 0 -#endif - /* * Allocate and free page tables. */ --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -20,9 +20,15 @@ #ifdef CONFIG_PAGE_TABLE_ISOLATION extern int kaiser_enabled; +/* + * Instead of one PGD, we acquire two PGDs. Being order-1, it is + * both 8k in size and 8k-aligned. That lets us just flip bit 12 + * in a pointer to swap between the two 4k halves. + */ #else #define kaiser_enabled 0 #endif +#define PGD_ALLOCATION_ORDER kaiser_enabled void ptdump_walk_pgd_level(struct seq_file *m, pgd_t *pgd); void ptdump_walk_pgd_level_checkwx(void);