Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2258990imm; Thu, 19 Jul 2018 16:38:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfUSqdemakOEaZpPI45ieWRVLXYL4fMRRX7EIVrcHipcKpZHcz8l1Yo8rvKpgKb/FrOaXQM X-Received: by 2002:a62:c60e:: with SMTP id m14-v6mr11498983pfg.40.1532043523734; Thu, 19 Jul 2018 16:38:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532043523; cv=none; d=google.com; s=arc-20160816; b=qZX8J6g7IlshTR+6JqpPAjwxRhKO2bAvfHfKxvR9JqZVZZYQvoB0uftLTglfHXpRNQ 4OXq57fZikWNOBSf4epF5Fs00mzVk7HDsC2MyzkgVELJ8/iP2qelZccPUGEiPZFb44no pRD3Z7h6eLnDfwR1lczCmezNFrki84NThRLmkjIZbLtsVod96NzJLMA40Jq60BB0B3L+ HNJBRlAYKw7X5TmQxV51IALzd1yWdfypLWOyITJ/hfuMoptI73U5Mp46lH4lPC3VoYWh SYfJ2COxU5VdfuXjX7uwDkgluKg7YaV8uNExPvQNsH8M6w47jrJRAybdqPmhom5U+y8d QhNg== 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=wr+6bgoJ8EWbs+3tWzzO347/wInKMUauSftxy0HBLwU=; b=oE6JYYtjAdCc+cm2hikr4ZR2m3GfsvIRmkpRyF4PeI3YR8PPSPT5eHpX1d2Hyy4Jiz N4fWzcz1NDTIJs+jPYgGfZJ0JSUhBHLbMvMh9nI4VKgTfQjD45XfOzLCfXvhgy+3z5P7 MTJrTqXqkDp/5nkhzN7VBnsdNLh/tOXMxNxK7XvtOCDjuYuAN3il3gYdpnotxxyPublX gecT+K++ar2dW0/QFO+GdxWt/0mashdBurC1bWpa9WSefG8/5RmcOE5Yp41/OU7uDDiw Ak7MdSOFRK/eHANjadqR0HmhVQlccDJ8vod1Agwy8Kq2d1RWKIJ5N+J53q73CnYIvD32 cdfA== 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 s16-v6si375230pgg.538.2018.07.19.16.38.29; Thu, 19 Jul 2018 16:38:43 -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 S1731581AbeGTAWn (ORCPT + 99 others); Thu, 19 Jul 2018 20:22:43 -0400 Received: from terminus.zytor.com ([198.137.202.136]:51353 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727650AbeGTAWn (ORCPT ); Thu, 19 Jul 2018 20:22:43 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w6JNaH3u2454473 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 19 Jul 2018 16:36:17 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w6JNaH1s2454469; Thu, 19 Jul 2018 16:36:17 -0700 Date: Thu, 19 Jul 2018 16:36:17 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Joerg Roedel Message-ID: Cc: bp@alien8.de, eduval@amazon.com, jgross@suse.com, dhgutteridge@sympatico.ca, jpoimboe@redhat.com, dave.hansen@intel.com, pavel@ucw.cz, luto@kernel.org, will.deacon@arm.com, David.Laight@aculab.com, aarcange@redhat.com, linux-kernel@vger.kernel.org, brgerst@gmail.com, mingo@kernel.org, jkosina@suse.cz, tglx@linutronix.de, hpa@zytor.com, boris.ostrovsky@oracle.com, peterz@infradead.org, torvalds@linux-foundation.org, dvlasenk@redhat.com, llong@redhat.com, jroedel@suse.de, gregkh@linuxfoundation.org Reply-To: mingo@kernel.org, brgerst@gmail.com, linux-kernel@vger.kernel.org, aarcange@redhat.com, will.deacon@arm.com, luto@kernel.org, David.Laight@aculab.com, dave.hansen@intel.com, pavel@ucw.cz, jpoimboe@redhat.com, bp@alien8.de, eduval@amazon.com, jgross@suse.com, dhgutteridge@sympatico.ca, gregkh@linuxfoundation.org, llong@redhat.com, jroedel@suse.de, dvlasenk@redhat.com, peterz@infradead.org, torvalds@linux-foundation.org, boris.ostrovsky@oracle.com, hpa@zytor.com, jkosina@suse.cz, tglx@linutronix.de In-Reply-To: <1531906876-13451-35-git-send-email-joro@8bytes.org> References: <1531906876-13451-35-git-send-email-joro@8bytes.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] x86/ldt: Define LDT_END_ADDR Git-Commit-ID: 8195d869d118bc30bf0be8d0c5d8849d6f58529b 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, DATE_IN_FUTURE_96_Q 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: 8195d869d118bc30bf0be8d0c5d8849d6f58529b Gitweb: https://git.kernel.org/tip/8195d869d118bc30bf0be8d0c5d8849d6f58529b Author: Joerg Roedel AuthorDate: Wed, 18 Jul 2018 11:41:11 +0200 Committer: Thomas Gleixner CommitDate: Fri, 20 Jul 2018 01:11:47 +0200 x86/ldt: Define LDT_END_ADDR It marks the end of the address-space range reserved for the LDT. The LDT-code will use it when unmapping the LDT for user-space. Signed-off-by: Joerg Roedel Signed-off-by: Thomas Gleixner Tested-by: Pavel Machek Cc: "H . Peter Anvin" Cc: linux-mm@kvack.org Cc: Linus Torvalds Cc: Andy Lutomirski Cc: Dave Hansen Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Peter Zijlstra Cc: Borislav Petkov Cc: Jiri Kosina Cc: Boris Ostrovsky Cc: Brian Gerst Cc: David Laight Cc: Denys Vlasenko Cc: Eduardo Valentin Cc: Greg KH Cc: Will Deacon Cc: aliguori@amazon.com Cc: daniel.gruss@iaik.tugraz.at Cc: hughd@google.com Cc: keescook@google.com Cc: Andrea Arcangeli Cc: Waiman Long Cc: "David H . Gutteridge" Cc: joro@8bytes.org Link: https://lkml.kernel.org/r/1531906876-13451-35-git-send-email-joro@8bytes.org --- arch/x86/include/asm/pgtable_32_types.h | 2 ++ arch/x86/include/asm/pgtable_64_types.h | 1 + arch/x86/kernel/ldt.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/pgtable_32_types.h b/arch/x86/include/asm/pgtable_32_types.h index 7297810747cf..b0bc0fff5f1f 100644 --- a/arch/x86/include/asm/pgtable_32_types.h +++ b/arch/x86/include/asm/pgtable_32_types.h @@ -53,6 +53,8 @@ extern bool __vmalloc_start_set; /* set once high_memory is set */ #define LDT_BASE_ADDR \ ((CPU_ENTRY_AREA_BASE - PAGE_SIZE) & PMD_MASK) +#define LDT_END_ADDR (LDT_BASE_ADDR + PMD_SIZE) + #define PKMAP_BASE \ ((LDT_BASE_ADDR - PAGE_SIZE) & PMD_MASK) diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h index 066e0ab9ffab..04edd2d58211 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h @@ -115,6 +115,7 @@ extern unsigned int ptrs_per_p4d; #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) +#define LDT_END_ADDR (LDT_BASE_ADDR + PGDIR_SIZE) #define __VMALLOC_BASE_L4 0xffffc90000000000UL #define __VMALLOC_BASE_L5 0xffa0000000000000UL diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c index c9b14020f4dd..e921b3d494d5 100644 --- a/arch/x86/kernel/ldt.c +++ b/arch/x86/kernel/ldt.c @@ -206,7 +206,7 @@ static void free_ldt_pgtables(struct mm_struct *mm) #ifdef CONFIG_PAGE_TABLE_ISOLATION struct mmu_gather tlb; unsigned long start = LDT_BASE_ADDR; - unsigned long end = start + (1UL << PGDIR_SHIFT); + unsigned long end = LDT_END_ADDR; if (!static_cpu_has(X86_FEATURE_PTI)) return;