From patchwork Wed Jul 18 09:40:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10531869 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 D7627600F4 for ; Wed, 18 Jul 2018 09:42:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C581F28FBC for ; Wed, 18 Jul 2018 09:42:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4F4A28FD5; Wed, 18 Jul 2018 09:42:40 +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 254CD28FBC for ; Wed, 18 Jul 2018 09:42:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6434D6B0286; Wed, 18 Jul 2018 05:41:36 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5A2BA6B0288; Wed, 18 Jul 2018 05:41:36 -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 3CDB66B0287; Wed, 18 Jul 2018 05:41:36 -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 D03056B0284 for ; Wed, 18 Jul 2018 05:41:35 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id g11-v6so1631517edi.8 for ; Wed, 18 Jul 2018 02:41:35 -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=YQx9cZdEuHeJE+gwrrn8Afu/0pGPh6Q3W4RpoMicy/s=; b=U60edIsJWpSI0gNEnZ93SIk9PTQJEmDHtOiWbfE3eL78syqrR8+sClbZM5PFz+cS26 xgqnkAjLu7jrIu/j+sAW7Gikl7keVI4w5qlfCDiL0kR566Guf5SDIHR43jeiREQ+Mn+g T8sYDVgYWJX//43vVT5hdeupSjPKyt86DguQ1x9GTvckDwtt2z6sdzuaARYp317JKh6W GRAc07U0Tgizj2es4cRZI/qkMAw4NriNgdP/O/yjJCCutVNunAaHPO6NTZSzkCEuMJ2b CKBemF3obwCDk9QZFVJzBDakeZgfD8mppFwnArY3Esojx20B+BK2jSbXoj/T0zacFqPb CvAA== X-Gm-Message-State: AOUpUlG+C5MqCh1LvqgJ9UIRsWIowPnHUmoz8rOmYfug+5ZB4wlUSZY7 +4M+FQq87tqs98a3GGNOu8SYPadPtm2qpgCf9hA5375PiAukuxpkneE4LWn5FpIO0ByqIaKdLTY 9+nEz6n9j4RxPpxgGx7hcv7xCvMfnm9+PlTDBvtojJh/dI0jrsmENxzC0syE0wYggwA== X-Received: by 2002:aa7:d1cb:: with SMTP id g11-v6mr6267008edp.163.1531906895427; Wed, 18 Jul 2018 02:41:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdu1040LF+yl3xwYH7lAb/euSemZbVfkMULFnO32ZdK3Y3PhJfH9j06qGK19JwxPy7qmtE7 X-Received: by 2002:aa7:d1cb:: with SMTP id g11-v6mr6266976edp.163.1531906894802; Wed, 18 Jul 2018 02:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531906894; cv=none; d=google.com; s=arc-20160816; b=Mfq1RG5ReNrGPVhZlWVmafOYufXbp4B5Z+jViIL6cd2NKyeONO/ChVKTP0ZcDS88Br y+7xuw5l9PkNkdNyLR506ZWwDnBNHC+L3EsMkT4ddZhWJlltdw+RFfleGwCxmUZaXlud xLvWUh5sZva7691vTkzd/KmDNPnAhhZ1r9CjxLoRFhpWFSgRUndmmHx9TD60MBXzqWej /mkJRgg/V8B/4lvdFKK7mJV1YEfRuMd2CyXROZX4DB2I5AI9UFGKG4cGCGEXYPgaBaGJ omvv/r9pEcXeHwbEdtI6ngu9WuG2FK2SNXGE0PcZvB5VSjhOBSkcsKjbI2WEzo+HFOrK N1VA== 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=YQx9cZdEuHeJE+gwrrn8Afu/0pGPh6Q3W4RpoMicy/s=; b=mT5CX8+lz77RHGyTWHjB3FLQjL70S/bJ5ZXt/BwoDz6WP3x0rJbGfu+sOLsRSGvh1q OBKitf++6M96ABfYbRtrI59PE+BQreFKX5hbhdZ0xhSX9YQf1zriKzD55yg2kKLX99pB pk44WzGBitxIF0RVFp8a6YjCNQ+CxUA7bdeiSrXhra+BAXAYNFRzdx4KMsr2FmX9pwol +/RpUDhDfGADF6feDpUG0o9M/0Dk1voDLVsCELhpmex2JBmSdrJSfyJa+TqBsJXqzKHG 4xqZC2c7smZR8AOZGkikF4AR9uWUCo4CBFaiSci3djwPr7dYkOOU2bsPHK+jLSr5WH7b /2AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b="VJtpa/zO"; 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 o32-v6si2477950edb.222.2018.07.18.02.41.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 02:41:34 -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="VJtpa/zO"; 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 47100A9C; 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=1531906883; bh=DSRqcm2/h0MeJA2B6bB5atAwDqT3xDCIA/VjkOUJHKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VJtpa/zO8sE3/L/x5Gx2q4gej24MF+EK3SKjVGnXx5ESbKLiKJYvcNlRz1OKnM2JN 0EihPsRdQXPVR4PDQB0+VmQpjbSANG4g8ozZLagqgsw5tEk5wfMGEF0VnxcF3hsRsY k9xsJDX5SBDcWLEjPSyad0om+NuJD0pTGVh7ia7hh1HDmiTAvHnO+6TUiPsTPQnu9H K0zTKQZCEd/SUhgxssq1pIDPfg6HAtHnnoqmEvqU27etI0gj3gi7cc/stfmoBAwNoR HKRKpXp0rRb6W6yNDPKmKb18D5/wSV5f4pXEDqfA5A1pZqi2MRikjUwmw7nNPQL1WS 6BD/l7SigMWvg== 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 22/39] x86/mm/pae: Populate the user page-table with user pgd's Date: Wed, 18 Jul 2018 11:40:59 +0200 Message-Id: <1531906876-13451-23-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 When we populate a PGD entry, make sure we populate it in the user page-table too. Signed-off-by: Joerg Roedel --- arch/x86/include/asm/pgtable-3level.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h index f24df59..f2ca313 100644 --- a/arch/x86/include/asm/pgtable-3level.h +++ b/arch/x86/include/asm/pgtable-3level.h @@ -98,6 +98,9 @@ static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd) static inline void native_set_pud(pud_t *pudp, pud_t pud) { +#ifdef CONFIG_PAGE_TABLE_ISOLATION + pud.p4d.pgd = pti_set_user_pgtbl(&pudp->p4d.pgd, pud.p4d.pgd); +#endif set_64bit((unsigned long long *)(pudp), native_pud_val(pud)); } @@ -229,6 +232,10 @@ static inline pud_t native_pudp_get_and_clear(pud_t *pudp) { union split_pud res, *orig = (union split_pud *)pudp; +#ifdef CONFIG_PAGE_TABLE_ISOLATION + pti_set_user_pgtbl(&pudp->p4d.pgd, __pgd(0)); +#endif + /* xchg acts as a barrier before setting of the high bits */ res.pud_low = xchg(&orig->pud_low, 0); res.pud_high = orig->pud_high;