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

Vivek Goyal vgoyal at redhat.com
Thu Mar 27 17:57:17 EDT 2014


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.

Thanks
Vivek



More information about the kexec mailing list