Re: [PATCH v2 10/14] Generate and save VMCOREINFO and ELF note information

HATAYAMA Daisuke
2011-12-20T09:32:14Z

Hello Kumagai-san,

From: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Subject: Re: [PATCH v2 10/14] Generate and save VMCOREINFO and ELF note information
Date: Tue, 20 Dec 2011 17:18:12 +0900

> Hi Hatayama-san,
>
>> [snipped]
>>
>> diff --git a/elf_info.c b/elf_info.c
>> index 114dd05..48f8510 100644
>> --- a/elf_info.c
>> +++ b/elf_info.c
>> @@ -760,7 +760,7 @@ get_nr_cpus(void)
>> int
>> has_pt_note(void)
>> {
>> - if (offset_pt_note_memory && size_pt_note_memory)
>> + if (offset_pt_note_memory || size_pt_note_memory)
>> return TRUE;
>> return FALSE;
>> }
>
> I have a question.
> In what kind of case is only one of the offset or the size set to 0 in PT_NOTE?
>

Thanks for your reviewing.

On sadump processing, offset_pt_note_memory represents file offset to
a temporary file created specifically for writing PT_NOTE section. So
offset_pt_note_memory is always 0. Its file pointer is set to struct
sadump_info::file_elf_note. Please look at the end of
sadump_generate_elf_note_from_dumpfile().

On the other hand, on both ELF and kdump-compressed format, PT_NOTE
section is always located in the middle of the vmcores. On either
formats, there's always another header before the PT_NOTE section: on
ELF, ELF header, and on kdump-compressed format, at least. So
offset_pt_note_memory is always strictly greater than 0 on these
formats.

If condition of has_pt_note() is not weakened in such a way,
has_pt_note() amounts to always false and execution in
write_kdump_header() always passes through writing oepration for
PT_NOTE section.

Thanks.
HATAYAMA, Daisuke