Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752355AbcLHIZe (ORCPT ); Thu, 8 Dec 2016 03:25:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52446 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750851AbcLHIZd (ORCPT ); Thu, 8 Dec 2016 03:25:33 -0500 Date: Thu, 8 Dec 2016 16:25:29 +0800 From: Baoquan He To: Alexnader Kuleshov Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, hpa@zytor.com, mingo@redhat.com, x86@kernel.org, keescook@chromium.org, yinghai@kernel.org, bp@suse.de, thgarnie@google.com, luto@kernel.org, anderson@redhat.com, dyoung@redhat.com, xlpang@redhat.com Subject: Re: [PATCH 2/2] x86/KASLR/64: Determine kernel text mapping size at runtime Message-ID: <20161208082529.GA3328@x1> References: <1481183765-4166-1-git-send-email-bhe@redhat.com> <1481183765-4166-3-git-send-email-bhe@redhat.com> <20161208081750.GA3998@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20161208081750.GA3998@localhost.localdomain> 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]); Thu, 08 Dec 2016 08:25:33 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3320 Lines: 64 On 12/08/16 at 02:17pm, Alexnader Kuleshov wrote: > Hello, > > On 12-08-16, Baoquan He wrote: > > #define KERNEL_MAPPING_SIZE_EXT (1024 * 1024 * 1024) > > -#if defined(CONFIG_RANDOMIZE_BASE) > > -#define KERNEL_IMAGE_SIZE KERNEL_MAPPING_SIZE_EXT > > -#else > > -#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024) > > -#endif > > +#define KERNEL_MAPPING_SIZE kernel_mapping_size Thanks for telling. I forget testing this case. Checking. > > After applying these patches I'm getting: > > CC arch/x86/kernel/setup.o > In file included from ./arch/x86/include/asm/page_types.h:47:0, > from ./arch/x86/include/asm/page.h:8, > from ./arch/x86/include/asm/thread_info.h:11, > from ./include/linux/thread_info.h:58, > from ./arch/x86/include/asm/preempt.h:6, > from ./include/linux/preempt.h:59, > from ./include/linux/spinlock.h:50, > from ./include/linux/seqlock.h:35, > from ./include/linux/time.h:5, > from ./include/uapi/linux/timex.h:56, > from ./include/linux/timex.h:56, > from ./include/linux/sched.h:19, > from arch/x86/kernel/setup.c:24: > arch/x86/kernel/setup.c: In function ‘dump_kernel_offset’: > ./arch/x86/include/asm/page_64_types.h:67:29: error: ‘kernel_mapping_size’ undeclared (first use in this function) > #define KERNEL_MAPPING_SIZE kernel_mapping_size > ^ > ./arch/x86/include/asm/pgtable_64_types.h:69:48: note: in expansion of macro ‘KERNEL_MAPPING_SIZE’ > #define MODULES_VADDR (__START_KERNEL_map + KERNEL_MAPPING_SIZE) > ^~~~~~~~~~~~~~~~~~~ > ./include/linux/printk.h:271:35: note: in expansion of macro ‘MODULES_VADDR’ > printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) > ^~~~~~~~~~~ > arch/x86/kernel/setup.c:826:3: note: in expansion of macro ‘pr_emerg’ > pr_emerg("Kernel Offset: 0x%lx from 0x%lx (relocation range: 0x%lx-0x%lx)\n", > ^~~~~~~~ > ./arch/x86/include/asm/page_64_types.h:67:29: note: each undeclared identifier is reported only once for each function it appears in > #define KERNEL_MAPPING_SIZE kernel_mapping_size > ^ > ./arch/x86/include/asm/pgtable_64_types.h:69:48: note: in expansion of macro ‘KERNEL_MAPPING_SIZE’ > #define MODULES_VADDR (__START_KERNEL_map + KERNEL_MAPPING_SIZE) > ^~~~~~~~~~~~~~~~~~~ > ./include/linux/printk.h:271:35: note: in expansion of macro ‘MODULES_VADDR’ > printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) > ^~~~~~~~~~~ > arch/x86/kernel/setup.c:826:3: note: in expansion of macro ‘pr_emerg’ > pr_emerg("Kernel Offset: 0x%lx from 0x%lx (relocation range: 0x%lx-0x%lx)\n", > ^~~~~~~~ > scripts/Makefile.build:293: recipe for target 'arch/x86/kernel/setup.o' failed > make[2]: *** [arch/x86/kernel/setup.o] Error 1 > scripts/Makefile.build:544: recipe for target 'arch/x86/kernel' failed > make[1]: *** [arch/x86/kernel] Error 2 > Makefile:988: recipe for target 'arch/x86' failed > make: *** [arch/x86] Error 2 > > here with disabled CONFIG_RANDOMIZE_MEMORY.