[PATCH v3 1/2] powerpc/crash: fix backup region offset update to elfcorehdr
Sourabh Jain
sourabhjain at linux.ibm.com
Thu Mar 12 21:44:06 AEDT 2026
On 12/03/26 14:06, Hari Bathini wrote:
>
>
> On 12/03/26 2:00 pm, Sourabh Jain wrote:
>> update_backup_region_phdr() in file_load_64.c iterates over all the
>> program headers in the kdump kernel’s elfcorehdr and updates the
>> p_offset of the program header whose physical address starts at 0.
>>
>> However, the loop logic is incorrect because the program header pointer
>> is not updated during iteration. Since elfcorehdr typically contains
>> PT_NOTE entries first, the PT_LOAD program header with physical address
>> 0 is never reached. As a result, its p_offset is not updated to point to
>> the backup region.
>>
>> Because of this behavior, the capture kernel exports the first 64 KB of
>> the crashed kernel’s memory at offset 0, even though that memory
>> actually lives in the backup region. When a crash happens, purgatory
>> copies the first 64 KB of the crashed kernel’s memory into the backup
>> region so the capture kernel can safely use it.
>>
>> This has not caused problems so far because the first 64 KB is usually
>> identical in both the crashed and capture kernels. However, this is
>> just an assumption and is not guaranteed to always hold true.
>>
>> Fix update_backup_region_phdr() to correctly update the p_offset of the
>> program header with a starting physical address of 0 by correcting the
>> logic used to iterate over the program headers.
>>
>
> Thanks for fixing this.
> Looks good to me.
>
> Reviewed-by: Hari Bathini <hbathini at linux.ibm.com>
Thanks for the review Hari.
- Sourabh Jain
More information about the Linuxppc-dev
mailing list