Received: by 10.223.185.116 with SMTP id b49csp2473977wrg; Mon, 5 Mar 2018 03:36:44 -0800 (PST) X-Google-Smtp-Source: AG47ELv1JO+ibgsJL+rHzvkKLcYW0SAxSvd/+jSk3jDUZvkieI/Y5AZVLknP8WKzOR21UQNdOhbu X-Received: by 2002:a17:902:2843:: with SMTP id e61-v6mr12905466plb.437.1520249804615; Mon, 05 Mar 2018 03:36:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520249804; cv=none; d=google.com; s=arc-20160816; b=zDjeDqTKCBwl5L09GaXoLNwSHhwp4kEr2/FtUrYpc+zAeUg6tMtKkdBwTeTFVr+uWW vYikWose5xGZBD7PlAjfNl5ZQ6RNxdf+z5nphGGjRhFJigqistvTQJefwyx647+uFZC/ xuberlvEE/NW6SqEnAJdbG7rWArdqWmEcsDYNF5qUAtV4Nl4duqGzQxA2YCAPK0Ht4x/ FgsGsI5fOA0gpCozyiQEMjhrpdh+7QkqiW6eKYV2SPHkp5F5qhWnVr3CoVnJHNQnZCpC J2IBoCVgMHaWeP5lj9rdkoG2r09Rzx/IeCVm+6wpaHgITsNfCol54/QzoivikoT63z+I b6TA== 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=N4WE/Zg3/azljJ9vk+e7rysEuRey95VTb4WIU/mTR/Y=; b=fA1PxZ7H7w1TwTj71AYj7oZFBES8vZFwW30zAT7ZIqKs5SS3lKQG5tHBd2BTma2Vbv 1aX2rCSJyghwXZ9UtIN/b+n5CNT1doDonjjmK6KDVApJkAFR64BkieEzOexcA22LRDG9 S13uQhrsAB8jSGP5IvnjMKmHCDuA2HE35/Lbbr6c2UNbuL0pOY2EyN7NVGtMDlxqBcKc qS3muGFj6X7LxxSHowp11zNKPEP9tAEm04CBdiqY3fNAwwOUHjOasvrruqnDKLDDJSht P2V0AoPomvO9PHbfRvtJ3n/5h6HTRrEwOGojvyiz437PSNmNgNpj8J5KcscMjZTexHDd mYeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=gYuZ9HXp; 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 p12-v6si6760389plk.295.2018.03.05.03.36.30; Mon, 05 Mar 2018 03:36:44 -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=gYuZ9HXp; 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 S933994AbeCEK2V (ORCPT + 99 others); Mon, 5 Mar 2018 05:28:21 -0500 Received: from 8bytes.org ([81.169.241.247]:54818 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933829AbeCEK0X (ORCPT ); Mon, 5 Mar 2018 05:26:23 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id AF60A426D; 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=sihEhEYifvZCNBiDUhmor3LuDpnqRdGkLaToPUS0PzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gYuZ9HXpiAxCfi6uQ7hZO6Bxef9pjsQOSLLBtl2+CNqnvMF4LLzdlTL7SSo94mLjy WvammJsBTVj3R+OC4Gn8DrJva+lp57X137ib3H7eP5ns14vF8mprpasRFNRxhxuZ9e PHx6r1J1wWgJioOtWp1tVecoRhRz2lG3yGkiQDjPCa7b+fy9dnKkS9p2s2wtQnjRCl dCA7CHhkL6d59O2UE/MpQcKFvkdGcc8kj9e2mf+HTRa7cm4Nc6bYpp2ydP634nIfvy TFKEzN/2MU+0Hory59eNIdMZCgR6EtufzPolU+jwxtNCSYyupRqftOhe7Ff0hhKTCA S2S9OhA1AXWEg== 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 29/34] x86/ldt: Reserve address-space range on 32 bit for the LDT Date: Mon, 5 Mar 2018 11:25:58 +0100 Message-Id: <1520245563-8444-30-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 Reserve 2MB/4MB of address-space for mapping the LDT to user-space on 32 bit PTI kernels. Signed-off-by: Joerg Roedel --- arch/x86/include/asm/pgtable_32_types.h | 7 +++++-- arch/x86/mm/dump_pagetables.c | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/pgtable_32_types.h b/arch/x86/include/asm/pgtable_32_types.h index 0777e18..eb2e97a 100644 --- a/arch/x86/include/asm/pgtable_32_types.h +++ b/arch/x86/include/asm/pgtable_32_types.h @@ -48,13 +48,16 @@ extern bool __vmalloc_start_set; /* set once high_memory is set */ ((FIXADDR_TOT_START - PAGE_SIZE * (CPU_ENTRY_AREA_PAGES + 1)) \ & PMD_MASK) -#define PKMAP_BASE \ +#define LDT_BASE_ADDR \ ((CPU_ENTRY_AREA_BASE - PAGE_SIZE) & PMD_MASK) +#define PKMAP_BASE \ + ((LDT_BASE_ADDR - PAGE_SIZE) & PMD_MASK) + #ifdef CONFIG_HIGHMEM # define VMALLOC_END (PKMAP_BASE - 2 * PAGE_SIZE) #else -# define VMALLOC_END (CPU_ENTRY_AREA_BASE - 2 * PAGE_SIZE) +# define VMALLOC_END (LDT_BASE_ADDR - 2 * PAGE_SIZE) #endif #define MODULES_VADDR VMALLOC_START diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index 2151ebb..fdefdf0 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -117,6 +117,9 @@ enum address_markers_idx { #ifdef CONFIG_HIGHMEM PKMAP_BASE_NR, #endif +#ifdef CONFIG_MODIFY_LDT_SYSCALL + LDT_NR, +#endif CPU_ENTRY_AREA_NR, FIXADDR_START_NR, END_OF_SPACE_NR, @@ -130,6 +133,9 @@ static struct addr_marker address_markers[] = { #ifdef CONFIG_HIGHMEM [PKMAP_BASE_NR] = { 0UL, "Persistent kmap() Area" }, #endif +#ifdef CONFIG_MODIFY_LDT_SYSCALL + [LDT_NR] = { 0UL, "LDT remap" }, +#endif [CPU_ENTRY_AREA_NR] = { 0UL, "CPU entry area" }, [FIXADDR_START_NR] = { 0UL, "Fixmap area" }, [END_OF_SPACE_NR] = { -1, NULL } @@ -579,6 +585,9 @@ static int __init pt_dump_init(void) # endif address_markers[FIXADDR_START_NR].start_address = FIXADDR_START; address_markers[CPU_ENTRY_AREA_NR].start_address = CPU_ENTRY_AREA_BASE; +# ifdef CONFIG_MODIFY_LDT_SYSCALL + address_markers[LDT_NR].start_address = LDT_BASE_ADDR; +# endif #endif return 0; } -- 2.7.4