[kexec-tools PATCH v2] x86, kaslr: add alternative way to locate kernel text mapping area

Simon Horman horms at verge.net.au
Fri Mar 28 12:44:20 EDT 2014


On Fri, Mar 28, 2014 at 10:05:22AM -0400, Vivek Goyal wrote:
> On Fri, Mar 28, 2014 at 03:05:00PM +0800, WANG Chao wrote:
> > When kASLR is enabled (CONFIG_RANDOMIZED_BASE=y), kernel text mapping
> > base is randomized. The max base offset of such randomization is
> > configured at compile time through CONFIG_RANDOMIZE_MAX_BASE_OFFSET (by
> > default 1G).
> > 
> > Currently kexec-tools is using hard code macro X86_64__START_KERNEL_map
> > (0xffffffff80000000) and X86_64_KERNEL_TEXT_SIZE (512M) to determine
> > kernel text mapping from kcore's PT_LOAD. With kASLR, the mapping is
> > changed as the following:
> > 
> > ffffffff80000000 - (ffffffff80000000+CONFIG_RANDOMIZE_BASE_MAX_OFFSET)
> > 
> > As Vivek suggested, we can get _stext kernel symbol address from
> > /proc/kallsyms, and search for kcore's PT_LOAD which contains _stext,
> > and we can say that this area represents the kernel mapping area.
> > 
> > Let's first use this way to find out kernel text mapping. If failed for
> > whatever reason, fall back to use the old way.
> > 
> > Suggested-by: Vivek Goyal <vgoyal at redhat.com>
> > Signed-off-by: WANG Chao <chaowang at redhat.com>
> 
> Looks good to me.
> 
> Acked-by: Vivek Goyal <vgoyal at redhat.com>

Thanks, applied.



More information about the kexec mailing list