Commit 615e73b3 authored by Magnus Damm's avatar Magnus Damm Committed by Paul Mundt

sh: disallow kexec virtual entry

Older versions of kexec-tools has a zImage loader that
passes a virtual address as entry point. The elf loader
otoh it passes a physical address as entry point, and
pages are always passed as physical addresses as well.

Only allow physical addresses from now on.
Signed-off-by: default avatarMagnus Damm <damm@igel.co.jp>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 7e6b6f2b
...@@ -46,6 +46,12 @@ void machine_crash_shutdown(struct pt_regs *regs) ...@@ -46,6 +46,12 @@ void machine_crash_shutdown(struct pt_regs *regs)
*/ */
int machine_kexec_prepare(struct kimage *image) int machine_kexec_prepare(struct kimage *image)
{ {
/* older versions of kexec-tools are passing
* the zImage entry point as a virtual address.
*/
if (image->start != PHYSADDR(image->start))
return -EINVAL; /* upgrade your kexec-tools */
return 0; return 0;
} }
...@@ -125,7 +131,8 @@ void machine_kexec(struct kimage *image) ...@@ -125,7 +131,8 @@ void machine_kexec(struct kimage *image)
/* now call it */ /* now call it */
rnk = (relocate_new_kernel_t) reboot_code_buffer; rnk = (relocate_new_kernel_t) reboot_code_buffer;
(*rnk)(page_list, reboot_code_buffer, image->start); (*rnk)(page_list, reboot_code_buffer,
(unsigned long)phys_to_virt(image->start));
#ifdef CONFIG_KEXEC_JUMP #ifdef CONFIG_KEXEC_JUMP
asm volatile("ldc %0, vbr" : : "r" (&vbr_base) : "memory"); asm volatile("ldc %0, vbr" : : "r" (&vbr_base) : "memory");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment