From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753068AbdLDRAE (ORCPT ); Mon, 4 Dec 2017 12:00:04 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:60426 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752865AbdLDQvk (ORCPT ); Mon, 4 Dec 2017 11:51:40 -0500 Message-Id: <20171204150608.517089374@linutronix.de> User-Agent: quilt/0.63-1 Date: Mon, 04 Dec 2017 15:07:51 +0100 From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Linus Torvalds , Andy Lutomirsky , Peter Zijlstra , Dave Hansen , Borislav Petkov , Greg KH , keescook@google.com, hughd@google.com, Brian Gerst , Josh Poimboeuf , Denys Vlasenko , Rik van Riel , Boris Ostrovsky , Juergen Gross , David Laight , Eduardo Valentin , aliguori@amazon.com, Will Deacon , daniel.gruss@iaik.tugraz.at Subject: [patch 45/60] x86/fixmap: Add ldt entries to user shared fixmap References: <20171204140706.296109558@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=x86-fixmap--Add_ldt_entries_to_user_shared_fixmap.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner LDT entries need to be user visible. Add them to the user shared fixmaps so they can be mapped to the actual location of the LDT entries of a process on task switch. Populate the PTEs upfront so the PMD sharing works. Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/fixmap.h | 3 +++ arch/x86/kernel/cpu/common.c | 2 ++ 2 files changed, 5 insertions(+) --- a/arch/x86/include/asm/fixmap.h +++ b/arch/x86/include/asm/fixmap.h @@ -20,6 +20,7 @@ #include #include #include +#include #ifdef CONFIG_X86_32 #include #include @@ -91,6 +92,8 @@ struct cpu_entry_area { */ struct debug_store_buffers cpu_debug_buffers; #endif + /* Provide fixmap space for user LDTs */ + char ldt_entries[LDT_ENTRIES * LDT_ENTRY_SIZE]; }; #define CPU_ENTRY_AREA_PAGES (sizeof(struct cpu_entry_area) / PAGE_SIZE) --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -613,6 +613,8 @@ static void __init setup_cpu_entry_area( set_percpu_fixmap_ptes(get_cpu_entry_area_index(cpu, cpu_debug_buffers), sizeof(struct debug_store_buffers) / PAGE_SIZE); #endif + set_percpu_fixmap_ptes(get_cpu_entry_area_index(cpu, ldt_entries), + (LDT_ENTRIES * LDT_ENTRY_SIZE) / PAGE_SIZE); } void __init setup_cpu_entry_areas(void)