Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753517AbcDVJoM (ORCPT ); Fri, 22 Apr 2016 05:44:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:38464 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751779AbcDVJoI (ORCPT ); Fri, 22 Apr 2016 05:44:08 -0400 Date: Fri, 22 Apr 2016 11:43:46 +0200 From: Borislav Petkov To: Ingo Molnar Cc: Kees Cook , Baoquan He , Yinghai Lu , Ingo Molnar , "x86@kernel.org" , Andrew Morton , Andrey Ryabinin , Dmitry Vyukov , "H.J. Lu" , Josh Poimboeuf , Andy Lutomirski , LKML Subject: Re: [PATCH 2/5] x86, KASLR: Drop CONFIG_RANDOMIZE_BASE_MAX_OFFSET Message-ID: <20160422094346.GA15172@pd.tnic> References: <1461185746-8017-1-git-send-email-keescook@chromium.org> <1461185746-8017-3-git-send-email-keescook@chromium.org> <20160421174423.GD29616@pd.tnic> <20160422071612.GA6819@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160422071612.GA6819@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1580 Lines: 41 On Fri, Apr 22, 2016 at 09:16:12AM +0200, Ingo Molnar wrote: > > * Kees Cook wrote: > > > >> + Since the kernel is built using 2GB addressing, > > > > > > Does that try to refer to the 1G kernel and 1G fixmap pagetable > > > mappings? I.e., level2_kernel_pgt and level2_fixmap_pgt in > > > arch/x86/kernel/head_64.S? > > > > The "2GB addressing" part is in reference to: > > > > -mcmodel=kernel > > Generate code for the kernel code model. The kernel runs in the > > negative 2 GB of the address space. This model has to be used for > > Linux kernel code. > > On x86-64 this is a special GCC compiler small memory model, it is called the > 'kernel code model', which is rather generic and no 'real name' ever stuck. > > Due to RIP-relative addressing and the sign-extension of 48 bit virtual addresses, > this allows nearly as compact kernel code and (static) kernel data definitions as > a 32-bit kernel would allow. > > The (positive) 0-4GB virtual memory range has similar advantages, but is of course > frequently used by user-space code. Negative addresses are reserved for the kernel > only. So it wouldn't hurt to have a more detailed explanation like this one in the text. And the 2G thing confused me maybe because it actually means 32-bit: 0x8000_0000 is 2G and is negative since the MSB is 1b. And I was wondering: "but what about 64-bit...?" Thanks. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --