From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034078AbdAEPIq (ORCPT ); Thu, 5 Jan 2017 10:08:46 -0500 Received: from mga04.intel.com ([192.55.52.120]:42749 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938614AbdAEPIh (ORCPT ); Thu, 5 Jan 2017 10:08:37 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,321,1477983600"; d="scan'208";a="919262399" Subject: Re: [RFC] x86/mm/KASLR: Remap GDTs at fixed location To: Ingo Molnar , Thomas Garnier References: <20170104221630.831-1-thgarnie@google.com> <20170105081114.GD2098@gmail.com> Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Kees Cook , Borislav Petkov , Andy Lutomirski , Dave Hansen , Chen Yucong , Paul Gortmaker , Andrew Morton , Masahiro Yamada , Sebastian Andrzej Siewior , Anna-Maria Gleixner , Boris Ostrovsky , Rasmus Villemoes , Michael Ellerman , Juergen Gross , Richard Weinberger , x86@kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Linus Torvalds , Peter Zijlstra From: Arjan van de Ven Message-ID: <4dffd167-9cfd-dfcc-6556-05d7ca8f4595@linux.intel.com> Date: Thu, 5 Jan 2017 07:08:05 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170105081114.GD2098@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/5/2017 12:11 AM, Ingo Molnar wrote: > > * Thomas Garnier wrote: > >> Each processor holds a GDT in its per-cpu structure. The sgdt >> instruction gives the base address of the current GDT. This address can >> be used to bypass KASLR memory randomization. With another bug, an >> attacker could target other per-cpu structures or deduce the base of the >> main memory section (PAGE_OFFSET). >> >> In this change, a space is reserved at the end of the memory range >> available for KASLR memory randomization. The space is big enough to hold >> the maximum number of CPUs (as defined by setup_max_cpus). Each GDT is >> mapped at specific offset based on the target CPU. Note that if there is >> not enough space available, the GDTs are not remapped. >> >> The document was changed to mention GDT remapping for KASLR. This patch >> also include dump page tables support. >> >> This patch was tested on multiple hardware configurations and for >> hibernation support. > >> void kernel_randomize_memory(void); >> +void kernel_randomize_smp(void); >> +void* kaslr_get_gdt_remap(int cpu); > > Yeah, no fundamental objections from me to the principle, but I get some bad vibes > from the naming here: seeing that kernel_randomize_smp() actually makes things > less random. > kernel_unrandomize_smp() ... one request.. can we make sure this unrandomization is optional?