From patchwork Wed Jul 11 11:29:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10519485 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3D1F8603D7 for ; Wed, 11 Jul 2018 11:31:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DCB726861 for ; Wed, 11 Jul 2018 11:31:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3120828837; Wed, 11 Jul 2018 11:31:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C67C226861 for ; Wed, 11 Jul 2018 11:31:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47F046B0284; Wed, 11 Jul 2018 07:30:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 402A26B0286; Wed, 11 Jul 2018 07:30:16 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27D356B0288; Wed, 11 Jul 2018 07:30:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id B72CC6B0286 for ; Wed, 11 Jul 2018 07:30:15 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id r21-v6so4649136edp.23 for ; Wed, 11 Jul 2018 04:30:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=TcOVtVnr+aW/8VDEtvIk3oEsqpy7c98bNgeUFUA7HCA=; b=Fov75oDnvbKt9ucGVB9rM5ADMrnJYv6fxqP6BzXgnqsuU1ao7HsQw1RVDtDrKJd85S rJYvqaUBZSEztXILnCqozA1rlhwi79CSJ66jhSLP3PS9T6NUX9e0+efDhLIpKiqCIhuR CjLbjjez8JgKnXjWuUZ8ORlVIQqvZPTjBVszDRn9fbs/dp5mon8nMsepic2y3D/TsUW5 fUCvycH6XPBwnzG24JV+8bbWXQ4u+i0uidpXS+58ZKppH9RRzMcEC2bRDM/+faBFzsd0 CFkp7E/GUFVzI+LHn6Nr5TrPGMrxjkJCGdvG/YXDGkR0Oa6lfnUhaz084QY17jb+kAvH rxfw== X-Gm-Message-State: APt69E2MDOaE7undQt20vpzFu5UGm+Mx4ktniGC+RmNryIOiifdCoWNo NSAusD5Y1w5h2i8uU00yYnaVPM5ugnJZg4IPKfiAj+uyBp2VkF5iahfjBBYhWc0CRkR/eXYvXru 0rQe+aRjsjV47WQEVL/GaY80aV0xc+WnHodMsSrTF4amjyT0N6ayAMQhKwY1LY63tvQ== X-Received: by 2002:aa7:d4da:: with SMTP id t26-v6mr14928573edr.121.1531308615336; Wed, 11 Jul 2018 04:30:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf9LSDV59TaczUtiBiZo3BKZ67+ymCXflMNKvUZFcarB5Y+iO/m/ew0wZFr9GXpqIdPK3sH X-Received: by 2002:aa7:d4da:: with SMTP id t26-v6mr14928535edr.121.1531308614714; Wed, 11 Jul 2018 04:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531308614; cv=none; d=google.com; s=arc-20160816; b=owR83Yu/gA1d8SaOnDmgraE+SnD9+mQmKhpIx8/sHBMEuQl/ioVjQugxnFL+AOMIBQ mF+/plVzIj+EVLCHdZdPL31UgGN7UT7+4xvGzSCwVV/MFU79BW5JIe345gU+fUgmdbYb IdBtI1uKH60MEVDBRmhl1ZL/mAVfIosUPfIsM5r8dXU6IBlua4cWL/vwX4e6DAMpB+Bs CQIeRQOirTvnsqZ0nYwwYkasObZldVPtealcwedbGoK/bY/amK22ORJuhuVMSdkhNzNL uyO70TEb4uqB+gymRU5UyTQ3ywQ4CzFGMT9Bmr5Rsltwopa7e107drs+pdHVsfFPKs6U MqzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=TcOVtVnr+aW/8VDEtvIk3oEsqpy7c98bNgeUFUA7HCA=; b=IF6Q5dwwvB18+YBYv2eWlYsiGjhFKLUfvepKUyXSIAQ9ezY7MIur/pr14+de25nW9u 55SMhK12SRUyfPKyPdsmZgu7kOyYM5bZ3iHu7cbLo3agzUYiPyJFA4S0e+iQXzrKKdB8 jpIyPuN9ETVKvHsnXeumkMh73kR/cf5pY7AaJxvMjtS1sz5Ovsw/8FWxq7/RaZyFlH8p tasY+rbvQA8fk2aKL55EEe8b6wOvurHsJl0To/9aCMbW7/edBoU2Gh7xTRzd0tWKJse3 U4heID6f3gXwYqiO2XQQv5CaViD3fv5Us2qS/PPImG7wkbqZL2+eo24Aq12Ox7ylH5XC jQQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=hfFWmCgt; spf=pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: from theia.8bytes.org (8bytes.org. [2a01:238:4383:600:38bc:a715:4b6d:a889]) by mx.google.com with ESMTPS id k28-v6si238760edk.175.2018.07.11.04.30.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 04:30:14 -0700 (PDT) Received-SPF: pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) client-ip=2a01:238:4383:600:38bc:a715:4b6d:a889; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=hfFWmCgt; spf=pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: by theia.8bytes.org (Postfix, from userid 1000) id 2D65DA68; Wed, 11 Jul 2018 13:30:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531308605; bh=ziU7MFEY35NOxqlMR4QOaylELpaocSSa3SwWrA7oOzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hfFWmCgtLlNhhBJpcEtBe5Nzt3pm2H+20dyxhTo6eV6ZyUO0YCQLUgUlpQQxGEdRa jP2lBhVjih10LzhD4M+4ACPhVB0CksCylGX26DHoPF9nrnpqVXpxf342F1ej3py/JC M/bW/FY1aE0UX8BzzU4lO5/fCsuZshzkoX8tc/XGqCv6okbvsZg7/UNRa+b/349XEW vYQchVeVOlsg67WcP8pvOJT1OkFMdOKAcsXDgsqbpIdx9AaMyWXHYshEHKcSJBkreR aSI65aEYv/goJ1wBJC3h/Tba95Q49ysPjf1+N7Evyj2bWIPmpU/YQechpbzm0gnZpH zFm9PIFJmx3vw== 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 , "David H . Gutteridge" , jroedel@suse.de, joro@8bytes.org Subject: [PATCH 23/39] x86/mm/legacy: Populate the user page-table with user pgd's Date: Wed, 11 Jul 2018 13:29:30 +0200 Message-Id: <1531308586-29340-24-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531308586-29340-1-git-send-email-joro@8bytes.org> References: <1531308586-29340-1-git-send-email-joro@8bytes.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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