From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938791AbdAEUwz (ORCPT ); Thu, 5 Jan 2017 15:52:55 -0500 Received: from mx2.suse.de ([195.135.220.15]:38730 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936619AbdAEUwr (ORCPT ); Thu, 5 Jan 2017 15:52:47 -0500 Date: Thu, 5 Jan 2017 21:52:43 +0100 From: Borislav Petkov To: Kees Cook Cc: Baoquan He , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , LKML , "x86@kernel.org" , Yinghai Lu , Thomas Garnier , Alexander Kuleshov , Andy Lutomirski , "Luis R. Rodriguez" , Dave Anderson , Dave Young Subject: Re: [PATCH v3 1/3] x86/64: Make kernel text mapping always take one whole page table in early boot code Message-ID: <20170105205242.lc4u44hrfxke4b2t@pd.tnic> References: <1483519053-23402-1-git-send-email-bhe@redhat.com> <1483519053-23402-2-git-send-email-bhe@redhat.com> <20170105032800.GE6937@x1> <20170105140112.amu3msg3hp7ome7v@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20161014 (1.7.1) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 05, 2017 at 11:35:57AM -0800, Kees Cook wrote: > The only reason I had it as an option was for kernel module space. It > wasn't clear to me at the time if enough space remained for modules in > all use-cases. It seems like probably there is, so I have no objection > to making the mapping 1G unconditionally. Oh someone will crawl out of the woodwork handwaiving that 1G of modules is not enough. But then that someone would have to choose between kaslr and >1G modules. Realistically, on a typical bigger machine, the modules take up something like <10M: $ lsmod | awk '{ sum +=$2 } END { print sum }' 7188480 so I'm not really worried if we reduce it by default to 1G. Besides, the reduction has been there for a while now - since CONFIG_RANDOMIZE_BASE - so we probably would've heard complaints already... Btw, we should probably document the reduction in the va map document too: --- From: Borislav Petkov Date: Thu, 5 Jan 2017 21:47:18 +0100 Subject: [PATCH] x86/mm: Document modules space reduction KASLR reduces module mapping space to 1G, document that. Signed-off-by: Borislav Petkov --- Documentation/x86/x86_64/mm.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/x86/x86_64/mm.txt b/Documentation/x86/x86_64/mm.txt index 5724092db811..a737dfbc198b 100644 --- a/Documentation/x86/x86_64/mm.txt +++ b/Documentation/x86/x86_64/mm.txt @@ -39,6 +39,8 @@ memory window (this size is arbitrary, it can be raised later if needed). The mappings are not part of any other kernel PGD and are only available during EFI runtime calls. +CONFIG_RANDOMIZE_BASE (KASLR) reduces module mapping space from 1.5G to 1G. + Note that if CONFIG_RANDOMIZE_MEMORY is enabled, the direct mapping of all physical memory, vmalloc/ioremap space and virtual memory map are randomized. Their order is preserved but their base will be offset early at boot time. -- 2.11.0 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --