Received: by 10.223.185.116 with SMTP id b49csp672589wrg; Wed, 14 Feb 2018 05:18:58 -0800 (PST) X-Google-Smtp-Source: AH8x2278QH1zBLoxxW5lQhuKSPpoDEmgSDP8dTH5y018a5m1acqa2AS1oorVTYUAoUWWkGgEaPnX X-Received: by 10.99.63.9 with SMTP id m9mr4007600pga.247.1518614338167; Wed, 14 Feb 2018 05:18:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518614338; cv=none; d=google.com; s=arc-20160816; b=UQyk1doOd8r0Et0FTq371W8y/IUhvuvhZdYqrtBr1G2en6cmHSsNqQgWoON9qlBwy4 LaarUk+NQez4cErtow36mwEGv4tWul4Gi7+E1O0wTwbbsEmSV44qVHRZ1WSEHHVIslqt kFVJKvnykb8wqvG0hH+TMY/Rqi5DeNBRj8hICXvwRmkNHL8fnHacEkKj2HiKzeBj42nm rthvNzhR+7oUBBIxgBHb34BVNfPWVo0i8Tms3mIn2tdsqjB/VbnDlbsU4idTQCPI+tdb FDRCS9Xe6I/S6rtqRBjPs+BRmnJOTaVf46d7B32gq4X7BMDGgpGkt09UzvBMaWy44Mcq kApg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=5pe33ESIOFkGkeBfteIgZ1WgLDTivViHYSwIyv27p/4=; b=yhyDYh2NKgAeYeZQa2iEvCSJoCBLhlF+i6GGhlFWcHH8xfmDfyufmY+fxqxvygQP8N snknkGG+F5CY5bJU8o6JIiXp4IzKEXHkRPRmu2bg//2T4OuJkXtjK6dPXrIad2jDYVrj jJkR5fEOaA9sag0UgMFqgm0GsbLtNCqQcdkDQK57IPaaIZuht2AgZyOPWiYAL/SR4rRy hj3b/EGPyOsgNH2kePGOAOrZgbzW1HkLT+8DQcwYZ8rBrdP/pz/3vq583eOzRoPqQAey stWlCIu8yvF8YBIULNYYcUGID4mdeibSn+5HLH6gKuqclQeFbNyoLUb3Xx8qa6yrTSFP z/Gg== 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 l7si634205pgr.492.2018.02.14.05.18.42; Wed, 14 Feb 2018 05:18:58 -0800 (PST) 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 S1030209AbeBNNQr (ORCPT + 99 others); Wed, 14 Feb 2018 08:16:47 -0500 Received: from terminus.zytor.com ([198.137.202.136]:54097 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967713AbeBNNQq (ORCPT ); Wed, 14 Feb 2018 08:16:46 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w1ED6NLX027368; Wed, 14 Feb 2018 05:06:23 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w1ED6N15027365; Wed, 14 Feb 2018 05:06:23 -0800 Date: Wed, 14 Feb 2018 05:06:23 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: "tip-bot for Kirill A. Shutemov" Message-ID: Cc: luto@amacapital.net, hpa@zytor.com, peterz@infradead.org, torvalds@linux-foundation.org, mingo@kernel.org, bp@suse.de, linux-kernel@vger.kernel.org, kirill.shutemov@linux.intel.com, tglx@linutronix.de Reply-To: kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, bp@suse.de, mingo@kernel.org, hpa@zytor.com, peterz@infradead.org, torvalds@linux-foundation.org, luto@amacapital.net In-Reply-To: <20180214111656.88514-6-kirill.shutemov@linux.intel.com> References: <20180214111656.88514-6-kirill.shutemov@linux.intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] x86/mm: Make LDT_BASE_ADDR dynamic Git-Commit-ID: 5c7919bb1994f8dc7fed219a5db09e6bb9d473a5 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 5c7919bb1994f8dc7fed219a5db09e6bb9d473a5 Gitweb: https://git.kernel.org/tip/5c7919bb1994f8dc7fed219a5db09e6bb9d473a5 Author: Kirill A. Shutemov AuthorDate: Wed, 14 Feb 2018 14:16:52 +0300 Committer: Ingo Molnar CommitDate: Wed, 14 Feb 2018 13:11:14 +0100 x86/mm: Make LDT_BASE_ADDR dynamic LDT_BASE_ADDR has different value in 4- and 5-level paging configurations. We need to make it dynamic in preparation for boot-time switching between paging modes. Signed-off-by: Kirill A. Shutemov Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/20180214111656.88514-6-kirill.shutemov@linux.intel.com Signed-off-by: Ingo Molnar --- arch/x86/include/asm/pgtable_64_types.h | 9 +++++---- arch/x86/mm/dump_pagetables.c | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h index 5e2d724..903e4d05 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h @@ -92,18 +92,19 @@ extern unsigned int pgtable_l5_enabled; */ #define MAXMEM _AC(__AC(1, UL) << MAX_PHYSMEM_BITS, UL) +#define LDT_PGD_ENTRY_L4 -3UL +#define LDT_PGD_ENTRY_L5 -112UL +#define LDT_PGD_ENTRY (pgtable_l5_enabled ? LDT_PGD_ENTRY_L5 : LDT_PGD_ENTRY_L4) +#define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) + #ifdef CONFIG_X86_5LEVEL # define VMALLOC_SIZE_TB _AC(12800, UL) # define __VMALLOC_BASE _AC(0xffa0000000000000, UL) # define __VMEMMAP_BASE _AC(0xffd4000000000000, UL) -# define LDT_PGD_ENTRY _AC(-112, UL) -# define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) #else # define VMALLOC_SIZE_TB _AC(32, UL) # define __VMALLOC_BASE _AC(0xffffc90000000000, UL) # define __VMEMMAP_BASE _AC(0xffffea0000000000, UL) -# define LDT_PGD_ENTRY _AC(-3, UL) -# define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) #endif #ifdef CONFIG_DYNAMIC_MEMORY_LAYOUT diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index 2a4849e..a89f2db 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -89,7 +89,7 @@ static struct addr_marker address_markers[] = { [KASAN_SHADOW_END_NR] = { KASAN_SHADOW_END, "KASAN shadow end" }, #endif #ifdef CONFIG_MODIFY_LDT_SYSCALL - [LDT_NR] = { LDT_BASE_ADDR, "LDT remap" }, + [LDT_NR] = { 0UL, "LDT remap" }, #endif [CPU_ENTRY_AREA_NR] = { CPU_ENTRY_AREA_BASE,"CPU entry Area" }, #ifdef CONFIG_X86_ESPFIX64 @@ -570,6 +570,9 @@ static int __init pt_dump_init(void) address_markers[LOW_KERNEL_NR].start_address = PAGE_OFFSET; address_markers[VMALLOC_START_NR].start_address = VMALLOC_START; address_markers[VMEMMAP_START_NR].start_address = VMEMMAP_START; +#ifdef CONFIG_MODIFY_LDT_SYSCALL + address_markers[LDT_NR].start_address = LDT_BASE_ADDR; +#endif #endif #ifdef CONFIG_X86_32 address_markers[VMALLOC_START_NR].start_address = VMALLOC_START;