[PATCH v2 1/2] powerpc/crash: fix backup region offset update to eflcorehdr
Sourabh Jain
sourabhjain at linux.ibm.com
Tue Mar 10 00:25:29 AEDT 2026
On 08/03/26 01:33, Aditya Gupta wrote:
> Sorry for the multiple mails, some mess up with my mail client.
>
> On 26/03/07 10:50AM, Sourabh Jain wrote:
>> <...snip...>
>>
>> arch/powerpc/kexec/file_load_64.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
> Minor nit in subject: s/eflcorehdr/elfcorehdr
I will update it in next version.
>> diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
>> index e7ef8b2a2554..e631cf2eda2c 100644
>> --- a/arch/powerpc/kexec/file_load_64.c
>> +++ b/arch/powerpc/kexec/file_load_64.c
>> @@ -391,7 +391,7 @@ static void update_backup_region_phdr(struct kimage *image, Elf64_Ehdr *ehdr)
>> unsigned int i;
>>
>> phdr = (Elf64_Phdr *)(ehdr + 1);
>> - for (i = 0; i < ehdr->e_phnum; i++) {
>> + for (i = 0; i < ehdr->e_phnum; i++, phdr++) {
>> if (phdr->p_paddr == BACKUP_SRC_START) {
>> phdr->p_offset = image->arch.backup_start;
>> kexec_dprintk("Backup region offset updated to 0x%lx\n",
> Interesting catch, I see in current images compiler was just optimising
> this to not even run more than 1 iteration since phdr never changed :)
>
> With the patch, able to see the offset changing now:
>
> Previously, without the patch:
> (gdb) p/x *phdr
> $13 = {
> p_type = 0x1,
> p_flags = 0x7,
> p_offset = 0x0, <--- never changed
> p_vaddr = 0xc000000000000000,
> p_paddr = 0x0,
> p_filesz = 0x10000,
> p_memsz = 0x10000,
> p_align = 0x0
> }
>
> With the patch, the offset gets set correctly:
> p_type = 0x1,
> p_flags = 0x7,
> p_offset = 0x240b0000,
> p_vaddr = 0xc000000000000000,
> p_paddr = 0x0,
> p_filesz = 0x10000,
> p_memsz = 0x10000,
> p_align = 0x0
>
> Can also see the kexec print:
>
> [ 29.377990] backup region offset updated to 0x240b0000
> [ 29.446360] loaded elf core header at 0x240c0000, bufsz=0x1000 memsz=0x80000
>
> Looks good to me, just minor nit in subject above.
>
> Reviewed-by: Aditya Gupta <adityag at linux.ibm.com>
Thank you for the review Aditya.
- Sourabh Jain
More information about the Linuxppc-dev
mailing list