From patchwork Wed Jul 18 09:41:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10531863 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 C1FAE602CA for ; Wed, 18 Jul 2018 09:42:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B151828FBC for ; Wed, 18 Jul 2018 09:42:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A500428FD8; Wed, 18 Jul 2018 09:42:33 +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 3830D28FC3 for ; Wed, 18 Jul 2018 09:42:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A392A6B0283; Wed, 18 Jul 2018 05:41:35 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 99C556B0287; Wed, 18 Jul 2018 05:41:35 -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 7EE646B0285; Wed, 18 Jul 2018 05:41:35 -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 E758B6B0284 for ; Wed, 18 Jul 2018 05:41:34 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id b25-v6so1680836eds.17 for ; Wed, 18 Jul 2018 02:41:34 -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=BGaQDWAQfc6eDUq9ccojcUxa5jHU5UVdZ1flq4x1+Vm35JkfAOON5SYfbNEZBM76G/ b2Q47UNQvlqI3cYrGfqf4Ucuxv+2gWFYDxXA0XrV5nTLHIYMQWKlNpCTvT7pUprP4IWu ppTNjYoVUgk3OKvQWP/n3PoSOqqaLAiuEi81CC81tY5c0QSOQxcpUFmRaBYiU4yMPQH3 p0up9xwZ+NLL3B/2wj/5AEgtZQfZyOmw33qJsA3Lw3qaLnWmo8nk3F1PifD8lowR9++k O3ZolXg+ZJPtcvQ34Oa83P2FRLwPRSZ09DJAQJLx3QcfzTTwnhkcZOCiBNhvTiP0Jz1J SGsQ== X-Gm-Message-State: AOUpUlGDbf/yvYFo8vHM34cgL1XIbMkR3n0BIwQEV5JYydDyo4cPiLkT 9ao+KG9gVUM6KtSgRcMA/pdefM6HxgXJLnn2tVeGtWkKa7GsvG7YrS1Ch84UKGLPdgvSeSW2oqY uxm+ef1Cj17zg1j1xXH2jc1pgY/W7khEkTdgDJW82eFM5RLcNKpmsRsY5vkDctawh9A== X-Received: by 2002:a50:b1f3:: with SMTP id n48-v6mr6162277edd.197.1531906894506; Wed, 18 Jul 2018 02:41:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdFjsvDzHLCW/eJ6jzkzyXBLal/79NEVvuR01tw8tYp8tKx9yYsvpl6ty+M1gjBmI7GhpN8 X-Received: by 2002:a50:b1f3:: with SMTP id n48-v6mr6162242edd.197.1531906893911; Wed, 18 Jul 2018 02:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531906893; cv=none; d=google.com; s=arc-20160816; b=CHsi8UYW5KnLpyIIdO7FAa98pqy8eQk8StDwJvfwRWZu9HcozkSRh38/amhQercfJ0 sMHBOUmcVPqbe+mnrk9iTkNKGoRb9GOQAL3eaNLW17MLWWsnxNoqQMmnezJ23PNnUb9M 36pe5r84bEDuL3fFCbg/9UlzS/IFTDmqRkax9VieNyRbJWB1HTJHSGOvpW/hi7fJDSyP cLD43i5BpMSqykWL92aWRIpTnqfqt/QYmzV8b3PZCh/+JBtCXyUH46b3bVuE6JeMlz2S 1DvppmCrCgzExV7GUNWTvYBU9kFdQNq3XcCwLrYAMbrteIVq7PI1kgw9gJHgDGFwozGD pZZA== 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=kZoRjw4ATCsbqOlzbZYcsaxUdipM8YYni4X8C+CshXvNFY4bW9ADZVwZQLrLRW2NSP F7nFByy5N+0NfavaCmfWqrS9g4aVLoLc3BCD5DbnGvq55BoyafipepTw40Z0gVPCMdV8 px1pSwtOghh5Cx1Ws19tMAgOCFZmR5cnR5JwM5lY+460NLzltzMlUBTtxwcqGLsq7RBk WgXOLDsVNAAmCID+u5eJAVHZHniMznCmSg9YGAjVLVCI3GG+eoN1xsOfaP0sUgPYxnCt iDQ0tGF6oVimXA5K2NViQN0BjD3GUyNC29sayvOGbb6gy5rXv6LL1lxdmtMOFJDi2uIu ScMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=KaFKIWyu; 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 o12-v6si818090edk.377.2018.07.18.02.41.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 02:41:33 -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=KaFKIWyu; 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 E5FC6774; Wed, 18 Jul 2018 11:41:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531906882; bh=ziU7MFEY35NOxqlMR4QOaylELpaocSSa3SwWrA7oOzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KaFKIWyu/3NDDLunZrvhDpnFwXPVYMz9AqTrEssqURl1Tk52lmCOSuXntQ8qbhzYv iZ/b2yVZlcdNjisTgYjXEkywZhXE54qLZeZTnLUTrPNFmpQJV+VBQk3su7kexRGax1 xKywZEst2UWH/87WEVm72cbwnt1Nxxmlpp3HTDcP1zAbEFAbtcydr/kYzLZ885RDa9 J4VSbsiXLvekYuKjcNYLn4QLeY3zQo6yQcIM8zS6zSjNKI+TvEszv+kyuNdHRahqHm 0B3+wj/qKzVpUOnotxK099lSNqROHJUbLCVOU3juGR3ccbeASNik6Pw5dvQZ3I5zT6 vNtPXNitRTgKQ== 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, 18 Jul 2018 11:41:00 +0200 Message-Id: <1531906876-13451-24-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531906876-13451-1-git-send-email-joro@8bytes.org> References: <1531906876-13451-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