Received: by 10.223.185.116 with SMTP id b49csp2474326wrg; Mon, 5 Mar 2018 03:37:08 -0800 (PST) X-Google-Smtp-Source: AG47ELuc6kVYkdGj/92Z2DcuC4L4MHVa9BA44vpkyYyG0B0WTC8B38V3hhzIw7Bn2twSozXqnf7t X-Received: by 10.167.128.194 with SMTP id a2mr15297981pfn.186.1520249827995; Mon, 05 Mar 2018 03:37:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520249827; cv=none; d=google.com; s=arc-20160816; b=OX/MdsOUugAYL+mZD8QCuLQvhtNFspm+OzMVp0ss2vOKSsdK0vPKdkH1ou2uu+EGPT Fcrggh4HDKB/gxn3FsP2jHvLHYvmOKjAwAg6y+wO2B2B6nrOh3sq0pPzLGc8I8ZrcP5c 4kKc5Ua4qAfM+ZkXGyRcm85sUNlVaCGK+QRFaOr1dm7Y106SIXXoJ19BrxTSHMSIaQCR gVJkWOVC6gxopPQ2cKZuBIljSM0FFBl5X1NGIoAFAW/ytt6y0DicWws0Yfg13QUJFKP0 r04K2OeL97zMCQ9DT7JyR32zhKqof7qfSu5oHD1n+POFq+2YD3ZT1GJ31U9dRAOok0Ya G3qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=TcOVtVnr+aW/8VDEtvIk3oEsqpy7c98bNgeUFUA7HCA=; b=1IipzZfOg/fhuBSlmv3agQrG07LDf87iY7d93Sg2gN+5IV+xwEis1Hgi72jU1c+FRb BLLVRLigGgGtOuYRNtVGvQQJCzwqkAieKvuD+ARBS67mNjAt7o62Wqab5mOuemjapWgT +/S9e4lzeCLRVSoZWzy3xVIQ2IX25mVgz+4ZTtiIoL5vryOPBWq+lx1vmh6gjka70WVG NPmmeubB6T+47bfuzjhiJMZv/jNGQLkDKSPMhKFSzBoSPiaDqQERH+NaQMIOxDtKLuMI 8DB3GP0pTdcJq32NXGU28/ydvPMi9+pVSnKJlf/OmHRZ2ER9nziEUibG44/mitafBS9+ m8+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=iCzvyA35; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e16-v6si9198530pli.337.2018.03.05.03.36.53; Mon, 05 Mar 2018 03:37:07 -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; dkim=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=iCzvyA35; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933703AbeCEK33 (ORCPT + 99 others); Mon, 5 Mar 2018 05:29:29 -0500 Received: from 8bytes.org ([81.169.241.247]:54324 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933803AbeCEK0U (ORCPT ); Mon, 5 Mar 2018 05:26:20 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id D3E8B4238; Mon, 5 Mar 2018 11:26:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1520245569; bh=ziU7MFEY35NOxqlMR4QOaylELpaocSSa3SwWrA7oOzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iCzvyA353yMDN/CTTe27XO9Iu2JNW3urHAf7NwdgRYvrg5ZsZ3nt7ecE/FZ+5sT3x Kutmx+LC5znp/FidE9RFTDpzh0mVKpPLIV/fJZpyUxXwbv37k1F2SxDPjZGH1CSr3N 8MqNn1GYoqvJw8sP6Mgw2RzGQ13AYdPdDRIuctAy4usp6M3DKR7WCTqgouTkoiTkcn 7dEoIZSBSgEQyPJ/99uZIUQ5Jv9LfgdrEJdcarsXDltDJDWNSPC9TZdn/2M07eXs0I j6WmzYsvCojvevYHKBcnuhsfrM7nJNXTkMhvUCtjlJ7m02EpAoSSHx5uGL/znWd6xv mzUUKJ6aUqccA== From: Joerg Roedel To: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, 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 , aliguori@amazon.com, daniel.gruss@iaik.tugraz.at, hughd@google.com, keescook@google.com, Andrea Arcangeli , Waiman Long , Pavel Machek , jroedel@suse.de, joro@8bytes.org Subject: [PATCH 23/34] x86/mm/legacy: Populate the user page-table with user pgd's Date: Mon, 5 Mar 2018 11:25:52 +0100 Message-Id: <1520245563-8444-24-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520245563-8444-1-git-send-email-joro@8bytes.org> References: <1520245563-8444-1-git-send-email-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel Also populate the user-spage pgd's in the user page-table. Signed-off-by: Joerg Roedel --- arch/x86/include/asm/pgtable-2level.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/include/asm/pgtable-2level.h b/arch/x86/include/asm/pgtable-2level.h index 685ffe8..c399ea5 100644 --- a/arch/x86/include/asm/pgtable-2level.h +++ b/arch/x86/include/asm/pgtable-2level.h @@ -19,6 +19,9 @@ static inline void native_set_pte(pte_t *ptep , pte_t pte) static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd) { +#ifdef CONFIG_PAGE_TABLE_ISOLATION + pmd.pud.p4d.pgd = pti_set_user_pgtbl(&pmdp->pud.p4d.pgd, pmd.pud.p4d.pgd); +#endif *pmdp = pmd; } @@ -58,6 +61,9 @@ static inline pte_t native_ptep_get_and_clear(pte_t *xp) #ifdef CONFIG_SMP static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp) { +#ifdef CONFIG_PAGE_TABLE_ISOLATION + pti_set_user_pgtbl(&xp->pud.p4d.pgd, __pgd(0)); +#endif return __pmd(xchg((pmdval_t *)xp, 0)); } #else @@ -67,6 +73,9 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp) #ifdef CONFIG_SMP static inline pud_t native_pudp_get_and_clear(pud_t *xp) { +#ifdef CONFIG_PAGE_TABLE_ISOLATION + pti_set_user_pgtbl(&xp->p4d.pgd, __pgd(0)); +#endif return __pud(xchg((pudval_t *)xp, 0)); } #else -- 2.7.4