x86/boot/KASLR: Fix kexec crash due to 'virt_addr' calculation bug
Kernel text KASLR is separated into physical address and virtual
address randomization. And for virtual address randomization, we
only randomiza to get an offset between 16M and KERNEL_IMAGE_SIZE.
So the initial value of 'virt_addr' should be LOAD_PHYSICAL_ADDR,
but not the original kernel loading address 'output'.
The bug will cause kernel boot failure if kernel is loaded at a different
position than the address, 16M, which is decided at compiled time.
Kexec/kdump is such practical case.
To fix it, just assign LOAD_PHYSICAL_ADDR to virt_addr as initial
Tested-by: Dave Young <firstname.lastname@example.org>
Signed-off-by: Baoquan He <email@example.com>
Cc: Linus Torvalds <firstname.lastname@example.org>
Cc: Peter Zijlstra <email@example.com>
Cc: Thomas Gleixner <firstname.lastname@example.org>
Fixes: 8391c73 ("x86/KASLR: Randomize virtual address separately")
Signed-off-by: Ingo Molnar <email@example.com>
3 files changed