kexec fails to boot kernels where CONFIG_RANDOMIZE_BASE=y is set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/22/14 at 09:16am, Vivek Goyal wrote:
> On Fri, Aug 22, 2014 at 07:59:02PM +0800, Baoquan He wrote:
> 
> [..]
> > So we have 2 choices for kexec/kdump:
> > 1) kexec/kdump kernel need not randomize the kernel starting point.
> > Since kexec/kdump kernel is only for testing or emergencey, its life is
> > not too long.
> > 
> > 2) makes slots around the kernel input addr. This is only useful for
> > kexec. I can't imagine why kdump need it. 
> > 
> > 
> > 
> > 
> > Hi Thomas,
> > Could you test below patch? 
> > 
> > 
> > This is patch is from Lu Yinghai.
> > ---
> >  arch/x86/boot/compressed/misc.c |   14 +++++++++-----
> >  1 file changed, 9 insertions(+), 5 deletions(-)
> > 
> > Index: linux-2.6/arch/x86/boot/compressed/misc.c
> > ===================================================================
> > --- linux-2.6.orig/arch/x86/boot/compressed/misc.c
> > +++ linux-2.6/arch/x86/boot/compressed/misc.c
> > @@ -235,8 +235,9 @@ static void error(char *x)
> >  		asm("hlt");
> >  }
> >  
> > -#if CONFIG_X86_NEED_RELOCS
> > -static void handle_relocations(void *output, unsigned long output_len)
> > +#ifdef CONFIG_X86_NEED_RELOCS
> > +static void handle_relocations(void *output_orig, void *output,
> > +			       unsigned long output_len)
> >  {
> >  	int *reloc;
> >  	unsigned long delta, map, ptr;
> > @@ -247,7 +248,7 @@ static void handle_relocations(void *out
> >  	 * Calculate the delta between where vmlinux was linked to load
> >  	 * and where it was actually loaded.
> >  	 */
> > -	delta = min_addr - LOAD_PHYSICAL_ADDR;
> > +	delta = min_addr - (unsigned long)output_orig;
> 
> So what does this patch actuall do? If I try to trace back output_orig,
> it seems to be same as LOAD_PHYSICAL_ADDR. That means there should not
> be any effect of this change? Or did I not understand it.

No, kexec kernel has to be relocatable kernel. so it shoule be the
value calculated by code block surrounded by the MACRO checking.

(startup_32 + %rip + BP_kernel_alignment -1 )& ~(BP_kernel_alignment-1)

#ifdef CONFIG_RELOCATABLE      
        leaq    startup_32(%rip) /* - $startup_32 */, %rbp
        movl    BP_kernel_alignment(%rsi), %eax 
        decl    %eax
        addq    %rax, %rbp     
        notq    %rax           
        andq    %rax, %rbp     
        cmpq    $LOAD_PHYSICAL_ADDR, %rbp
        jge     1f
#endif
        movq    $LOAD_PHYSICAL_ADDR, %rbp
1:        
          
        /* Target address to relocate to for decompression */
        leaq    z_extract_offset(%rbp), %rbx
> 
> Look at head_64.S
> 
> movq    $LOAD_PHYSICAL_ADDR, %rbp
> ...
> ...
> movq    %rbp, %r8               /* output target address */
> call    decompress_kernel       /* returns kernel location in %rax */
> 
> Thanks
> Vivek
> 
> _______________________________________________
> kexec mailing list
> kexec at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux