[PATCH] powerpc: Fix loading of kernel + initramfs with kexec_file_load()

Thiago Jung Bauermann bauerman at linux.ibm.com
Thu May 23 14:43:29 AEST 2019


Dave Young <dyoung at redhat.com> writes:

> On 05/22/19 at 07:01pm, Thiago Jung Bauermann wrote:
>> Commit b6664ba42f14 ("s390, kexec_file: drop arch_kexec_mem_walk()")
>> changed kexec_add_buffer() to skip searching for a memory location if
>> kexec_buf.mem is already set, and use the address that is there.
>> 
>> In powerpc code we reuse a kexec_buf variable for loading both the kernel
>> and the initramfs by resetting some of the fields between those uses, but
>> not mem. This causes kexec_add_buffer() to try to load the kernel at the
>> same address where initramfs will be loaded, which is naturally rejected:
>> 
>>   # kexec -s -l --initrd initramfs vmlinuz
>>   kexec_file_load failed: Invalid argument
>> 
>> Setting the mem field before every call to kexec_add_buffer() fixes this
>> regression.
>> 
>> Fixes: b6664ba42f14 ("s390, kexec_file: drop arch_kexec_mem_walk()")
>> Signed-off-by: Thiago Jung Bauermann <bauerman at linux.ibm.com>
>> ---
>>  arch/powerpc/kernel/kexec_elf_64.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> Reviewed-by: Dave Young <dyoung at redhat.com>

Thanks!

-- 
Thiago Jung Bauermann
IBM Linux Technology Center



More information about the Linuxppc-dev mailing list