Received: by 10.223.185.116 with SMTP id b49csp2474026wrg; Mon, 5 Mar 2018 03:36:47 -0800 (PST) X-Google-Smtp-Source: AG47ELvwVRTibBkqPZhV9GJjU8zdeUlfs7oBLI3ZEUPkuhTaMwZGudbMFu9cQYsoHRC8PdgjLuSj X-Received: by 10.98.70.198 with SMTP id o67mr14929178pfi.173.1520249807586; Mon, 05 Mar 2018 03:36:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520249807; cv=none; d=google.com; s=arc-20160816; b=bIxzY7zzOB1RhIg9hrRfqZXG6J0UYy2psf5+eg1Q/Zo4oU08eva2AeHE62DAEbBfSE mXOh0FOFmEPM71KAQKX/5FuN3HxcaatW8lcm6ri/8JnckACxa+WMhJclflhUK/XbLkpr azHu4lQEM+JDAjN6Tsl9oR7BYHUTzJ3BO9S5ywAoO1LQtB0pWbp9h8Y8GxX0RlQMxi35 xflXnRdriYNXhCiwdycZ+H50tD/XyWZsVM6AnIms9wN6yC0qVYUxs+zHxXlIgllaSIng sV6Gjp06owNmuM6c5zpd04lTgpnKE23CKFH6qw6lP8XyxZzrNac7Rb6nSRa0n6jlGXYP W8NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=RGA25vQ8gBPaSKGy/lT4lV6mDQVKRyvseZa9z9ApG6o=; b=BrmoLM/48s5zonNowjOtBO2awJOjMMQ/FW1e3wkBjSthiyQYU7xjZjL5jM43WOMsFM VOGgDV8t2Ad4UfKS+dh5oGq/MLOIUEirEdTwvBQMh2qg8PaTkqkLqYGPeTokki/HmxVR Ji2u0UuLm2RF1wX8BMx0US3rEznnQjTMqzfzi5Yrl1rThrdB4wsjZnnxyiSUFkZEYn2H bPVIbErtSKTrIfUV14Z/VCDs7jYYYxgqQEvT1UtIvwVI8NFIhSMC+WqhGoKLQ7B4hABk /NXSXbr1/gnxG2xwBpeQFZ/jRLvtWsn7tiyQKod2W+uWMXMR/bobPxCJowkwV/q4Ey6P qJFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=GwadVX5x; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t132si8198972pgc.238.2018.03.05.03.36.32; Mon, 05 Mar 2018 03:36:47 -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; dkim=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=GwadVX5x; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934004AbeCEK20 (ORCPT + 99 others); Mon, 5 Mar 2018 05:28:26 -0500 Received: from 8bytes.org ([81.169.241.247]:54458 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933827AbeCEK0X (ORCPT ); Mon, 5 Mar 2018 05:26:23 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id 904FB5020; Mon, 5 Mar 2018 11:26:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1520245570; bh=UmCwEUDVVU6qFE+SiRP1f6DBXNVe7DXPjR27sMU6P4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GwadVX5xbDkLcZSRtai39vja0Tu/B0Cwy+G2mEdUeuHMBnGhdJCesronYouCSa9Ym +RIteo2X7uOn1ABi2QxPwJmv2mOFuM3TZJwUs+/nHPAMmHpVFHDsrQZQX6Lk4k1fkY Jc2FTBOOCNTPVu8w6Dz12sUg5t5pw7/jBRhUkHdcTHK9NIYsFoG4SsQOEUm1F8JK/J 0PzBHw0EqQkFBvOz2C3aL4viAxV77SNm5L/wxrLpVX25aJXwzY4LFYHXAYmzkNnqRk HvxbJDCZSE88M/VevSLQ12ddJIcv9YbVwrAo6xJLXV2YJZqivH4my4PRbezpKXutOP xTeuTClhuLs0w== 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 , jroedel@suse.de, joro@8bytes.org Subject: [PATCH 30/34] x86/ldt: Define LDT_END_ADDR Date: Mon, 5 Mar 2018 11:25:59 +0100 Message-Id: <1520245563-8444-31-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520245563-8444-1-git-send-email-joro@8bytes.org> References: <1520245563-8444-1-git-send-email-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel 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 --- arch/x86/include/asm/pgtable_32_types.h | 2 ++ arch/x86/include/asm/pgtable_64_types.h | 2 ++ arch/x86/kernel/ldt.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/pgtable_32_types.h b/arch/x86/include/asm/pgtable_32_types.h index eb2e97a..02bd445 100644 --- a/arch/x86/include/asm/pgtable_32_types.h +++ b/arch/x86/include/asm/pgtable_32_types.h @@ -51,6 +51,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 e57003a..15188baa 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h @@ -90,12 +90,14 @@ typedef struct { pteval_t pte; } pte_t; # define __VMEMMAP_BASE _AC(0xffd4000000000000, UL) # define LDT_PGD_ENTRY _AC(-112, UL) # define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) +#define LDT_END_ADDR (LDT_BASE_ADDR + PGDIR_SIZE) #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) +#define LDT_END_ADDR (LDT_BASE_ADDR + PGDIR_SIZE) #endif #ifdef CONFIG_RANDOMIZE_MEMORY diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c index 26d713e..f3c2fbf 100644 --- a/arch/x86/kernel/ldt.c +++ b/arch/x86/kernel/ldt.c @@ -202,7 +202,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; -- 2.7.4