Received: by 10.213.65.68 with SMTP id h4csp1071000imn; Fri, 6 Apr 2018 14:04:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx48fZDnqcEIU8X/Z6qhpbt4FGPlOX1BnTWNuP0HFfndQuK8l8ZZYxXIdBsZqWXlfu37yflx5 X-Received: by 10.101.76.77 with SMTP id l13mr18647342pgr.192.1523048695741; Fri, 06 Apr 2018 14:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523048695; cv=none; d=google.com; s=arc-20160816; b=QqoI8YA/xAViG2jplI/x9PfYczm7Es/jMX+lIlBadTg0+SxEoDIr6G2fob5Kono6K+ 5m8tJ6+mu7deVcYV45Dr3gYTWlWxDEdAVfFc1l6wCQ87K0466wjisLlDldb7XCEt7LGX r8h5kkrRLelmbecbsklAIn+jedxQU0FONQqtYp34ufX1RPSV0kI+WPOgJTHX55VhufJy yYf+gvjgOwGnCDKcsWehDY0uyyd/0Msu+LhKi4Z6Rlss+MAxzCnFguyuMIoy+YnNttzg D0Js5EFh7Zo4jXWyC2aPmm/aVACqnKFH2oQVMSkiXyW/6TEgPbWqayDhtfzoJXXYG07x s/Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to:references:date :from:cc:to:subject:arc-authentication-results; bh=8E1F+3h48xpyp3VI+YB0i4kItl3wrUdV01es3x8vlz0=; b=GQHfJjDNkZK69F4vgaBCniPNe3EaDUpQuQF0PmNDHJwCfewgFlsEK1dLIvs43vzRlQ ef1MMo7v2UNeASzCc4sJzjnn1H1SMzUyFRdKgfl4lb4/cQWynfr91jP+HUDlC/9Lk2Fn i7Q6bVIfxASBNuVVsGIM3J0FmmyUR9vIw+Y1FFicsX7fZTTQ/KSGSwafFOwI7Fttjxog p2yqCwMCKUQbplqj9zZi9x+yBo0FbKzsfwd03dXjHoDHnwJs+FhzbCJu2pjgDcI8gurM uQIzFQzjoHXd4diI2C8dxD6pvjmsJgUh04GwCDmqqPXQJJTy1uMB0RGRw6tBJOrxMKOc MyHg== 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 p8si1892659pgn.406.2018.04.06.14.04.19; Fri, 06 Apr 2018 14:04:55 -0700 (PDT) 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 S1752666AbeDFVAE (ORCPT + 99 others); Fri, 6 Apr 2018 17:00:04 -0400 Received: from mga05.intel.com ([192.55.52.43]:63493 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752033AbeDFU6E (ORCPT ); Fri, 6 Apr 2018 16:58:04 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Apr 2018 13:58:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,416,1517904000"; d="scan'208";a="30138515" Received: from viggo.jf.intel.com (HELO localhost.localdomain) ([10.54.39.119]) by fmsmga007.fm.intel.com with ESMTP; 06 Apr 2018 13:58:04 -0700 Subject: [PATCH 04/11] x86/espfix: document use of _PAGE_GLOBAL To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Dave Hansen , aarcange@redhat.com, luto@kernel.org, torvalds@linux-foundation.org, keescook@google.com, hughd@google.com, jgross@suse.com, x86@kernel.org, namit@vmware.com From: Dave Hansen Date: Fri, 06 Apr 2018 13:55:07 -0700 References: <20180406205501.24A1A4E7@viggo.jf.intel.com> In-Reply-To: <20180406205501.24A1A4E7@viggo.jf.intel.com> Message-Id: <20180406205507.BCF4D4F0@viggo.jf.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Hansen The "normal" kernel page table creation mechanisms using PAGE_KERNEL_* page protections will never set _PAGE_GLOBAL with PTI. The few places in the kernel that always want _PAGE_GLOBAL must avoid using PAGE_KERNEL_*. Document that we want it here and its use is not accidental. Signed-off-by: Dave Hansen Cc: Andrea Arcangeli Cc: Andy Lutomirski Cc: Linus Torvalds Cc: Kees Cook Cc: Hugh Dickins Cc: Juergen Gross Cc: x86@kernel.org Cc: Nadav Amit --- b/arch/x86/kernel/espfix_64.c | 4 ++++ 1 file changed, 4 insertions(+) diff -puN arch/x86/kernel/espfix_64.c~espfix-use-kern-defaults-not-supported arch/x86/kernel/espfix_64.c --- a/arch/x86/kernel/espfix_64.c~espfix-use-kern-defaults-not-supported 2018-04-06 10:47:55.343796126 -0700 +++ b/arch/x86/kernel/espfix_64.c 2018-04-06 10:47:55.346796126 -0700 @@ -195,6 +195,10 @@ void init_espfix_ap(int cpu) pte_p = pte_offset_kernel(&pmd, addr); stack_page = page_address(alloc_pages_node(node, GFP_KERNEL, 0)); + /* + * __PAGE_KERNEL_* includes _PAGE_GLOBAL, which we want since + * this is mapped to userspace. + */ pte = __pte(__pa(stack_page) | ((__PAGE_KERNEL_RO | _PAGE_ENC) & ptemask)); for (n = 0; n < ESPFIX_PTE_CLONES; n++) set_pte(&pte_p[n*PTE_STRIDE], pte); _