Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752641AbcLJBca (ORCPT ); Fri, 9 Dec 2016 20:32:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58486 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752226AbcLJBc2 (ORCPT ); Fri, 9 Dec 2016 20:32:28 -0500 Date: Sat, 10 Dec 2016 09:32:23 +0800 From: Baoquan He To: Dave Anderson Cc: Kees Cook , LKML , Thomas Gleixner , "H. Peter Anvin" , Ingo Molnar , x86@kernel.org, Yinghai Lu , Borislav Petkov , Thomas Garnier , Alexander Kuleshov , Andy Lutomirski , Dave Young , Xunlei Pang Subject: Re: [PATCH 0/2] Determine kernel text mapping size at runtime for x86_64 Message-ID: <20161210013223.GB1034@x1> References: <1481183765-4166-1-git-send-email-bhe@redhat.com> <1018201061.5338919.1481223604680.JavaMail.zimbra@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1018201061.5338919.1481223604680.JavaMail.zimbra@redhat.com> User-Agent: Mutt/1.7.0 (2016-08-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 10 Dec 2016 01:32:28 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2576 Lines: 76 On 12/08/16 at 02:00pm, Dave Anderson wrote: > > > ----- Original Message ----- > > On Wed, Dec 7, 2016 at 11:56 PM, Baoquan He wrote: > > > Dave Anderson ever told in Crash utility he makes judgement whether it's > > > a kaslr kernel by size of KERNEL_IMAGE_SIZE. As long as it's 1G, it's > > > recognized as kaslr. Then the current upstream kernel has a wrong behaviour, > > > it sets KERNEL_IMAGE_SIZE as 1G as long as CONFIG_RANDOMIZE_BASE is enabled, > > > though people specify "nokaslr" into cmdline to disable kaslr explicitly. > > > > I'm not sure that's the correct solution to the Crash utility -- the > > kaslr-ness of a kernel should be already exposed in the dump with the > > kaslr_enabled variable yes? > > The crash utility doesn't use KERNEL_IMAGE_SIZE to determine whether > KASLR is in play, but rather to determine the base of the modules virtual > address space (i.e, the same way the kernel does). And then it uses that > value in a couple other places. Then I got it wrong. The current code makes it the same: #define MODULES_VADDR (__START_KERNEL_map + KERNEL_IMAGE_SIZE) With change, Crash doesn't need to change. Thanks Baoquan > > > > > > > So in this patchset, made changes to determine the size of kernel text > > > mapping > > > area at runtime. If "nokaslr" specified, kernel mapping size is 512M though > > > CONFIG_RANDOMIZE_BASE is enabled. > > > > This seems to make the non-KASLR case more consistent, so I'm fine > > with the idea. Once the build-bots are happy with everything, consider > > the series: > > > > Acked-by: Kees Cook > > > > Thanks! > > > > -Kees > > > > > > > > Baoquan He (2): > > > x86/64: Make kernel text mapping always take one whole page table in > > > early boot code > > > x86/KASLR/64: Determine kernel text mapping size at runtime > > > > > > arch/x86/boot/compressed/kaslr.c | 15 ++++++++++----- > > > arch/x86/include/asm/kaslr.h | 1 + > > > arch/x86/include/asm/page_64_types.h | 20 ++++++++++++-------- > > > arch/x86/include/asm/pgtable_64_types.h | 2 +- > > > arch/x86/kernel/head64.c | 11 ++++++----- > > > arch/x86/kernel/head_64.S | 16 +++++++++------- > > > arch/x86/mm/dump_pagetables.c | 3 ++- > > > arch/x86/mm/init_64.c | 2 +- > > > arch/x86/mm/physaddr.c | 6 +++--- > > > 9 files changed, 45 insertions(+), 31 deletions(-) > > > > > > -- > > > 2.5.5 > > > > > > > > > > > -- > > Kees Cook > > Nexus Security > >