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

WANG Chao chaowang at redhat.com
Fri Mar 28 02:20:43 EDT 2014


On 03/27/14 at 05:57pm, Vivek Goyal wrote:
> On Thu, Mar 27, 2014 at 06:25:48PM +0800, WANG Chao wrote:
> 
> [..]
> > @@ -169,6 +200,31 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
> >  			}
> >  		}
> >  	}
> > +
> > +	/* Go through /proc/kcore again. This time we find the region
> > +	 * where _stext symbol is located in */
> 
> Hi Chao,
> 
> How about doing it reverse. Using _stext seems to be the right thing to
> do both for kaslr enabled as well as kaslr disabled kernel. Right now
> assuming that kernel text mapping fall in a certain area is a hack
> and will break if kernel addresses are shifted again for whatever reason.
> 
> So we can first look for kernel mapping using _stext. If /proc/kallsyms
> is not present, then we can fall back using hardcoded address range
> between X86_64__START_KERNEL_map and X86_64__START_KERNEL_map +
> X86_64_KERNEL_TEXT_SIZE.

Good point. I'll post V2.

Thanks
WANG Chao



More information about the kexec mailing list