From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752353AbbHMI5j (ORCPT ); Thu, 13 Aug 2015 04:57:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59686 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751993AbbHMI5g (ORCPT ); Thu, 13 Aug 2015 04:57:36 -0400 From: Baoquan He To: ebiederm@xmission.com, akpm@linux-foundation.org, vgoyal@redhat.com, keescook@chromium.org Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Baoquan He Subject: [Patch v3 RESEND] kexec: export KERNEL_IMAGE_SIZE to vmcoreinfo Date: Thu, 13 Aug 2015 16:57:27 +0800 Message-Id: <1439456247-7968-1-git-send-email-bhe@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In x86_64, since v2.6.26 the KERNEL_IMAGE_SIZE is changed to 512M, and accordingly the MODULES_VADDR is changed to 0xffffffffa0000000. However, in v3.12 Kees Cook introduced kaslr to randomise the location of kernel. And the kernel text mapping addr space is enlarged from 512M to 1G. That means now KERNEL_IMAGE_SIZE is variable, its value is 512M when kaslr support is not compiled in and 1G when kaslr support is compiled in. Accordingly the MODULES_VADDR is changed too to be: #define MODULES_VADDR (__START_KERNEL_map + KERNEL_IMAGE_SIZE) So when kaslr is compiled in and enabled, the kernel text mapping addr space and modules vaddr space need be adjusted. Otherwise makedumpfile will collapse since the addr for some symbols is not correct. Hence KERNEL_IMAGE_SIZE need be exported to vmcoreinfo and got in makedumpfile to help calculate MODULES_VADDR. Signed-off-by: Baoquan He Acked-by: Kees Cook Acked-by: Vivek Goyal --- kernel/kexec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/kexec.c b/kernel/kexec.c index a785c10..b813c9c 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -2012,6 +2012,9 @@ static int __init crash_save_vmcoreinfo_init(void) #endif VMCOREINFO_NUMBER(PG_head_mask); VMCOREINFO_NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE); +#ifdef CONFIG_X86 + VMCOREINFO_NUMBER(KERNEL_IMAGE_SIZE); +#endif #ifdef CONFIG_HUGETLBFS VMCOREINFO_SYMBOL(free_huge_page); #endif -- 2.1.0