Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4786210ooa; Tue, 14 Aug 2018 10:31:31 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxFeHze25JTA1NFWjCf50Y+K/LuWU1Zg2t2/mkTwqN0h3sBe0MYFZ5eCVIWu+utprwN1cj5 X-Received: by 2002:a65:5284:: with SMTP id y4-v6mr21062893pgp.283.1534267891297; Tue, 14 Aug 2018 10:31:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534267891; cv=none; d=google.com; s=arc-20160816; b=N240v5I87YoLqwN7DrFj/Q+ImtUb/OOFOHK/0wQkSYJyKDAXhbyD1yMaI8uSUhgQUp 4hMap/JedVYKLDDk/tVRMVBXo8uYtNHd/SPhL2xMZKSiI0KfhrnjF09XOfXfFNT50Tg2 uOp+ZDcj+aPqK0pY43VcVLr2iSzu1HEo6t6KSSCfYm9YD2b6Ulot2osZ3BgfEWJLats7 jKL62nJPQ1y4cE8MnpDrK9tDzo7LndIalNfVzKbFVbWdCoCTNwmFDmHyaHgIeROL71yq /mGz7y+fBL2m0y1HXJiE8QtwikYhQtsWj9ml+le79bXEdSbaAMj1fNfTMALWi697BjD1 DL6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=1bqIezj23l6ZcUKDq1cb4HAx0oA3cr2ql7nqq3e8uxQ=; b=TK7uTuWb4eN1fyHzvEJiQB/c3OOh+hryARrcrPvwIoQYwuo2gN3MmZ0VQCjny/qAN1 RE1mrRtmZEcCOKtipzJh7bv16Px5SKbjDNdxrwtANobsbaq5p/wX9P5JEFiduzAfuCkZ yYOfeTivD5Yfd5x1T3qq94DEXJcDB3a7OvsjTnUY9BhLtSL2vwmr4g9o/HBDCZ99LV6c eRuGHWn6nkC7Ezkdpl1WQapqn0CiKC4z9pqGAdkohPHHsxp17yR0ajEOKTIuqQapAWXM LH8Hlav0yVskOKIWSpYF6/Kr30z/v4QfeZYmHtdv/CELWC7YQDOH0/fWGiw4IdRPzGUk wcBw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u10-v6si16530109plu.506.2018.08.14.10.30.53; Tue, 14 Aug 2018 10:31:31 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388886AbeHNUQN (ORCPT + 99 others); Tue, 14 Aug 2018 16:16:13 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52584 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733240AbeHNUQM (ORCPT ); Tue, 14 Aug 2018 16:16:12 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F2F6E40B; Tue, 14 Aug 2018 17:28:05 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andi Kleen , Thomas Gleixner Subject: [PATCH 4.18 76/79] x86/mm/pat: Make set_memory_np() L1TF safe Date: Tue, 14 Aug 2018 19:17:35 +0200 Message-Id: <20180814171341.054441030@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180814171336.799314117@linuxfoundation.org> References: <20180814171336.799314117@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andi Kleen set_memory_np() is used to mark kernel mappings not present, but it has it's own open coded mechanism which does not have the L1TF protection of inverting the address bits. Replace the open coded PTE manipulation with the L1TF protecting low level PTE routines. Passes the CPA self test. Signed-off-by: Andi Kleen Signed-off-by: Thomas Gleixner Signed-off-by: Greg Kroah-Hartman --- arch/x86/mm/pageattr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c @@ -1014,8 +1014,8 @@ static long populate_pmd(struct cpa_data pmd = pmd_offset(pud, start); - set_pmd(pmd, __pmd(cpa->pfn << PAGE_SHIFT | _PAGE_PSE | - massage_pgprot(pmd_pgprot))); + set_pmd(pmd, pmd_mkhuge(pfn_pmd(cpa->pfn, + canon_pgprot(pmd_pgprot)))); start += PMD_SIZE; cpa->pfn += PMD_SIZE >> PAGE_SHIFT; @@ -1087,8 +1087,8 @@ static int populate_pud(struct cpa_data * Map everything starting from the Gb boundary, possibly with 1G pages */ while (boot_cpu_has(X86_FEATURE_GBPAGES) && end - start >= PUD_SIZE) { - set_pud(pud, __pud(cpa->pfn << PAGE_SHIFT | _PAGE_PSE | - massage_pgprot(pud_pgprot))); + set_pud(pud, pud_mkhuge(pfn_pud(cpa->pfn, + canon_pgprot(pud_pgprot)))); start += PUD_SIZE; cpa->pfn += PUD_SIZE >> PAGE_SHIFT;