[PATCH] get MODULES_VADDR by KERNEL_IMAGE_SIZE for x86_64

bhe at redhat.com bhe at redhat.com
Thu Sep 18 01:42:05 PDT 2014


On 09/18/14 at 08:35am, Atsushi Kumagai wrote:
> >diff --git a/makedumpfile.c b/makedumpfile.c
> >index b4d43d8..48d73a8 100644
> >--- a/makedumpfile.c
> >+++ b/makedumpfile.c
> >@@ -1564,6 +1564,12 @@ get_value_for_old_linux(void)
> > 			NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE) =
> > 			PAGE_BUDDY_MAPCOUNT_VALUE_v2_6_39_to_latest_version;
> > 	}
> >+#ifdef __x86_64__
> >+	if (NUMBER(KERNEL_IMAGE_SIZE) == NOT_FOUND_NUMBER) {
> >+		if (info->kernel_version < KERNEL_VERSION(2, 6, 26))
> >+			NUMBER(KERNEL_IMAGE_SIZE) = MODULES_VADDR_ORIG;
> >+	}
> >+#endif
> 
> This code looks wrong, the value of MODULES_VADDR will overflow as:
> 
>   MODULES_VADDR = __START_KERNEL_map + NUMBER(KERNEL_IMAGE_SIZE)
>                 = 0xffffffff80000000 + 0xffffffff88000000
> 
> I think the code should be fixed as:
> 
> makedumpfile.h:
>     #define __START_KERNEL_map      (0xffffffff80000000)
>     #define KERNEL_IMAGE_SIZE_ORIG      (0x0000000008000000) /* 2.6.25, or former */
>     #define KERNEL_IMAGE_SIZE_2_6_26    (0x0000000020000000) /* 2.6.26, or later  */
>     #define MODULES_VADDR          (__START_KERNEL_map + NUMBER(KERNEL_IMAGE_SIZE))
> 
> makedumpfile.c:
> 	if (NUMBER(KERNEL_IMAGE_SIZE) == NOT_FOUND_NUMBER) {
> 		if (info->kernel_version < KERNEL_VERSION(2, 6, 26))
> 			NUMBER(KERNEL_IMAGE_SIZE) = KERNEL_IMAGE_SIZE_ORIG;
> 		else
> 			NUMBER(KERNEL_IMAGE_SIZE) = KERNEL_IMAGE_SIZE_2_6_26;
> 	}
> 
> 
> Thanks
> Atsushi Kumagai

Hi Atsushi,

This is the definition of KERNEL_IMAGE_SIZE
in arch/x86/include/asm/page_64_types.h. It's not 0xffffffff88000000.
KERNEL_IMAGE_SIZE is a size value.

#define KERNEL_IMAGE_SIZE_DEFAULT      (512 * 1024 * 1024)
#if defined(CONFIG_RANDOMIZE_BASE) && \
        CONFIG_RANDOMIZE_BASE_MAX_OFFSET > KERNEL_IMAGE_SIZE_DEFAULT
#define KERNEL_IMAGE_SIZE   CONFIG_RANDOMIZE_BASE_MAX_OFFSET
#else
#define KERNEL_IMAGE_SIZE      KERNEL_IMAGE_SIZE_DEFAULT
#endif

Thanks
Baoquan




More information about the kexec mailing list