From patchwork Wed Jul 11 11:29:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10519539 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 F420B6032A for ; Wed, 11 Jul 2018 11:32:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0235928592 for ; Wed, 11 Jul 2018 11:32:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E991A28B8A; Wed, 11 Jul 2018 11:32:48 +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 8C9E2285A5 for ; Wed, 11 Jul 2018 11:32:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 763376B02B1; Wed, 11 Jul 2018 07:31:48 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6E77E6B02B2; Wed, 11 Jul 2018 07:31:48 -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 5B7556B02B3; Wed, 11 Jul 2018 07:31:48 -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 E2ACD6B02B1 for ; Wed, 11 Jul 2018 07:31:47 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id p5-v6so1428712edh.16 for ; Wed, 11 Jul 2018 04:31:47 -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=S4MgOOtbnkkfJuMRU2k7i/vCCmzXOxdDizUjf0gP0lA=; b=OtOESmCAUCeXrXUoNw//UDp7uqZ0IZBAY+D248IV4NwP/f5LyKIXoP5YeqFjCvDbtx ot/Zvh1D4qdpU+csrn9HnvhonEp7v+aPlPa7PqjIg/AgPmumbGtJryaWpzVyOkhv32+L laQOvTwmgDvMjzgAj7Ea3HXWETQhymYEqwSGqJQGUKTJa70DexGwAeBNCSIgzKfqrx8y YA4yI4eupnkE0AknSs21gzzcZSvk1F1NK44YmCq4yKaviefYawm8CltQR+wYTtno7pXv wV329zykhN+cBzjwKUcsE0TumqN+18Q5YDIJ0Z2Dut/sb2DR3uTqBms34T/53EmyYmqI 7/8w== X-Gm-Message-State: APt69E2zAPqzD2XP/Ge3nnLreErPBqTnu0yFyzc7jyilixaspVYQWvjT ZAJ+pCcUdkwiK9xfqMHQ7/v9BrWLvSfwpDjVwDG+fs6FfnA3wXM0BpU7hmFiEKr6tdqxtYGAhkT YkzEVD1tIaxP3uzp7hta/i3HAXyx406nf9NpJV5qgHJI/Iz7JACxXzT7CPthvl8G/+A== X-Received: by 2002:a50:ca02:: with SMTP id d2-v6mr29432937edi.53.1531308707498; Wed, 11 Jul 2018 04:31:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf6x2roPp0GIUMsafkU4XtzoKSxEu3PiS6/7YXVzYU7ohB/yulICQsoRwtcAJmOWYabnj5d X-Received: by 2002:a50:ca02:: with SMTP id d2-v6mr29427897edi.53.1531308611690; Wed, 11 Jul 2018 04:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531308611; cv=none; d=google.com; s=arc-20160816; b=fc0JSf2dJl8737gTxMhbADY4rthFm3MhSrUQ64FYLkMTUomCVVEhhnDxhH4+L3sTn2 naMTVl3iQNmS+gEZNhjuf+ATvDmA1koimpkkiBv8UEHorpkrIQQirVFD7FefpX67r76e a0kYC0n6DAfcrIQPWN/hC+OLWs7FZ5D1U877R2cRXw42DVsL/mwelwWnvXbDBtDDCOUE CJoIPYKrtgUAfwGVL8ure3YdgJ70MBwk5qnqIOjtuidHHfvmHFmjanblnZfh/HuJ6tlq fellPBV3J/USt9lR7H00mRF5W0WuUKKDjV7gvUn1GxNMteIG4ze3FQDC1LTTf86DdjHG ft9g== 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=S4MgOOtbnkkfJuMRU2k7i/vCCmzXOxdDizUjf0gP0lA=; b=1CBZ7ExcqWl68v5almHC9ZzyursrMh7JraLYtQ486Sbz001DH8UNM4qictmPrbw4ra nb1sN2NkwXV8XvvI7KQjfrnx9WOZfuRRKlHBwlHIEcBlZebGUyaRIfo0sL1GJOz4I3QK gJdkXQmO/O1IbMINooGD/p9lZCOa+WJ2KpHRnObwsDXtWmpGlDqtup8tcJXdjKfdzX+Q 2WswYVH/1pk6s/GnoMSYWrnsztDoZnnJFXWQ9FEV4lf8usa/byg2JG1sXgWoOkeL5Fac fpbxoXLwJ+gd1SiIGmIj5P4lWS13X/ZAk2b6dPNxZZpgIx9KVXe/Fm/S50XLQ9ejTXlV Wlhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=D10ARwIb; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 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. [81.169.241.247]) by mx.google.com with ESMTPS id j2-v6si2653434edq.304.2018.07.11.04.30.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 04:30:11 -0700 (PDT) Received-SPF: pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) client-ip=81.169.241.247; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=D10ARwIb; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 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 5432B8C0; Wed, 11 Jul 2018 13:30:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531308603; bh=qYlJ2zsyHaAhXUQt0Hazi8E1heNgKD3G46Knr4YajHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D10ARwIbKulSGO3F3WCH/Mm5raDVe+fmAZlPNY7owe3froqAYyA9nA7fOAx9Pr0jb tPmwJF+FIhnqr5N/z36o1okE/OFdV13r9lIDXJ4PStPx7K3ReVg1aiLT2KIFlZkqm4 cWSztOk3vBUiIJ5TeSjIgRuP92ZW+zcODhLNQIlwRumoW9jwPdhHrtLNIsRq3H7ELZ keyDwWD6Rv8QOANBY6gURq98qUVNsWAK5jlhSR0/Xfbl2z5m0uBnoKVxw4Y+UQ4j9C 9f+eA+jr/+rE7W+4vDwvpFJyPxaYlQNsZITINKf0VTWdCqxoKzXLhmQtuOFoRgi3hG VohqNqz0kafDA== 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 16/39] x86/pgtable/pae: Unshare kernel PMDs when PTI is enabled Date: Wed, 11 Jul 2018 13:29:23 +0200 Message-Id: <1531308586-29340-17-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 With PTI we need to map the per-process LDT into the kernel address-space for each process, so we need separate kernel PMDs per PGD. Signed-off-by: Joerg Roedel --- arch/x86/include/asm/pgtable-3level_types.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/pgtable-3level_types.h b/arch/x86/include/asm/pgtable-3level_types.h index 6a59a6d..78038e0 100644 --- a/arch/x86/include/asm/pgtable-3level_types.h +++ b/arch/x86/include/asm/pgtable-3level_types.h @@ -21,9 +21,10 @@ typedef union { #endif /* !__ASSEMBLY__ */ #ifdef CONFIG_PARAVIRT -#define SHARED_KERNEL_PMD (pv_info.shared_kernel_pmd) +#define SHARED_KERNEL_PMD ((!static_cpu_has(X86_FEATURE_PTI) && \ + (pv_info.shared_kernel_pmd))) #else -#define SHARED_KERNEL_PMD 1 +#define SHARED_KERNEL_PMD (!static_cpu_has(X86_FEATURE_PTI)) #endif /*