Received: by 10.223.176.5 with SMTP id f5csp449209wra; Fri, 9 Feb 2018 01:36:42 -0800 (PST) X-Google-Smtp-Source: AH8x227vcASRLX3S94xnOKYBguF4Epx2xpf0JpmpvnCSbSuFpvpp4flWrxk5OGhdJDbnfy4xctLr X-Received: by 2002:a17:902:6a81:: with SMTP id n1-v6mr1988518plk.11.1518169002211; Fri, 09 Feb 2018 01:36:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518169002; cv=none; d=google.com; s=arc-20160816; b=OhHLrKU5VeZYEO9YM9RuZBE2p9tou/FRKVLT4JHORIqJCskSmcwyoFm3+6ERaWYswK yrVY7TcNbFoiBioRmG5gcIu1wvt/MJhV27xDPHsCNkVC1+9XK6DR7qXLPW8PhwG55Weu sOVynaxy9ZuLPMebheuwhQzvSImYYL++Wm1Fcb5/zICmn1FPfHD2STRIEP6/kQ2zCWjq ta2ZHqulRUw6flP85qfo+fXdBHgzpotGFEX0PVawmEm7i0NTNZdn70h8nBRdrqWm2KL5 ksKecMceeTF1n88MtAlk5IFuxeqNxDnNCNSZanSL2Twu8jpxUBMreYA1c9RAKDf6t2b2 5c0A== 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=xg+AaEAuaGjZ1uB3W9vPyacpGtnPhtq2PnVl56DOf1k=; b=il8vuyUc6+iohomlgYu3JQHgAhh6V4OyZlZF4B2Ycx7ZWFVwNtUBU5Qd1bAJso8Ydj IQZK62He7Qd5i+bSN3ueVptqPuLRW/lpPnBwmMUMXeZOFyUpvItfieik1Pn6wZUR1Gpy cjstxeD2pp+AEHldfRwe9OPhc/JUR+amnijIU0Ji0zh2hI9sErPM1ZIc8jovtqxYjHz0 kpoXF98xjxMkhjgRORBfqqgxDfwMODv95R4hcOYMaAnQ9E1g3fVFGHVHjmfr3asyOYqD AZosJrAGWSZrJPv+F8e8l6eFvlFFVTrs+kYX8/XoB/GTeFzmSOo/2Dcwxk64yRWCM0Bh pRQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=LIyfyuma; 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 75si1460884pfj.125.2018.02.09.01.36.24; Fri, 09 Feb 2018 01:36:42 -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=LIyfyuma; 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 S1752761AbeBIJb4 (ORCPT + 99 others); Fri, 9 Feb 2018 04:31:56 -0500 Received: from 8bytes.org ([81.169.241.247]:43208 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752223AbeBIJ0E (ORCPT ); Fri, 9 Feb 2018 04:26:04 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id 823BD99B; Fri, 9 Feb 2018 10:25:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1518168354; bh=Q+q/6+abthBaxS7bglX24etobsv9AfneJuRIorEl81Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LIyfyumaadAQKz/vpv1oeod+SxT964VwrS8DxKqnZYtqeQtC1GsSQcktTR44J1wX7 TwkrytOus/x4f2r4rMbohXcyF4PUz6esM07d0IkdoFrfA2ZTX24qCtBbmQliqMAmeE iACTLZiIX4/vSQ8hWXBeuDsG0HdSllHI+OvXR4VZP4Xi5UtLPW7vAhXSLSe2Mf3K59 ac5MvYQjYV6vhKfdgglv47gc2R/7qvCBrm9FRtnajUYBDbcu6VRSrPRUNbMnJVdtbG viDohIs9GJaDcrr5Qpsbo4tND7l/OxlDZFGwu4/Q3avby/2brjf9K29F0/Sk5rCPPA BeOYbFy15EU1w== 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 21/31] x86/mm/legacy: Populate the user page-table with user pgd's Date: Fri, 9 Feb 2018 10:25:30 +0100 Message-Id: <1518168340-9392-22-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518168340-9392-1-git-send-email-joro@8bytes.org> References: <1518168340-9392-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..d772554 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_pgd(&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_pgd(&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_pgd(&xp->p4d.pgd, __pgd(0)); +#endif return __pud(xchg((pudval_t *)xp, 0)); } #else -- 2.7.4