[Makedumpfile PATCH] elf_info: fix file_size if segment is excluded

Atsushi Kumagai ats-kumagai at wm.jp.nec.com
Mon May 8 19:29:03 PDT 2017


Hello Pratyush,

Thanks for your report, I have just one question.

>> exclude_segment() is called for Crash Kernel whose range is
>> 2b000000-350fffff.
>>
>> We see following after exclude_segment()
>>
>> LOAD (2)
>>  phys_start : 100000
>>  phys_end   : 2affffff
>>  virt_start : ffff8a5a40100000
>>  virt_end   : ffff8a5a6affffff
>>  file_offset: a5a40102000
>>  file_size  : dfefd000
>> LOAD (3)
>>  phys_start : 35100000
>>  phys_end   : dfffd000
>>  virt_start : ffff8a5a75100000
>>  virt_end   : ffff8a5b1fffd000
>>  file_offset: a5a75102000
>>  file_size  : 0
>>
>> Since file_size is calculated wrong therefore readpage_elf() does not
>> behave correctly.
>>
>> This patch fixes above wrong behavior.
>>
>> Signed-off-by: Pratyush Anand <panand at redhat.com>
>> ---
>> elf_info.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/elf_info.c b/elf_info.c
>> index 8e2437622141..6bf5e3373595 100644
>> --- a/elf_info.c
>> +++ b/elf_info.c
>> @@ -826,9 +826,12 @@ static int exclude_segment(struct pt_load_segment **pt_loads,
>>                temp_seg.virt_end = vend;
>>                temp_seg.file_offset = (*pt_loads)[i].file_offset
>>                    + temp_seg.virt_start - (*pt_loads)[i].virt_start;
>> +                temp_seg.file_size = temp_seg.phys_end
>> +                    - temp_seg.phys_start;
>>
>>                (*pt_loads)[i].virt_end = kvstart - 1;
>>                (*pt_loads)[i].phys_end =  start - 1;
>> +                (*pt_loads)[i].file_size -= temp_seg.file_size;

I think we should additionally subtract (end - start), right ? 
This code seems to leave Crash Kernel region for the former half of PT_LOAD.

Thanks,
Atsushi Kumagai

>>                tidx = i+1;
>>            } else if (kvstart != vstart) {
>> --
>> 2.9.3
>>




More information about the kexec mailing list