From: "YAMAZAKI MASAMITSU(山崎 真光)" <yamazaki-msmt@nec.com>
To: "Jiri Bohac" <jbohac@suse.cz>,
"kexec@lists.infradead.org" <kexec@lists.infradead.org>,
"HAGIO KAZUHITO(萩尾 一仁)" <k-hagio-ab@nec.com>
Subject: Re: [PATCH makedumpfile] makedumpfile: make reserve_diskspace do nothing for flattened format
Date: Tue, 6 Aug 2024 09:02:22 +0000 [thread overview]
Message-ID: <99a146b3-bf8d-4de2-9d9c-0abcc705b3a6@nec.com> (raw)
In-Reply-To: <5b665470-182f-4414-8a9b-b1ebf5337b2c@nec.com>
On 2024/07/19 17:00, HAGIO KAZUHITO(萩尾 一仁) wrote:
> Hi Jiri,
>
> sorry for the long delay.
>
> On 2024/06/19 21:04, Jiri Bohac wrote:
>> makedumpfile: make reserve_diskspace do nothing for flattened format
>>
>> reserve_diskspace() is called by write_elf_header() to make sure there is
>> always space to write the program header, even if writing other data fails
>> because of ENOSPC.
>>
>> This is harmful when writing the flattened format to STDOUT for two reasons:
>>
>> First, it actually wastes disk space, because first the block of zeroes is sent
>> to STDOUT by reserve_diskspace() and then the actual program header is sent,
>> meant to overwrite the zeroes when the flattened format is rearranged.
>>
>> Second, the algorithm used to read flattened format directly by the crash
>> program does not cope with the flattened file containing two chunks meant for
>> the same offset. It uses a binary search on a sorted array of flat_data headers
>> to find the data in the flat file. It may return the zeroed chunk written by
>> reserve_diskspace() near the beginning of the file instead of the actual ELF
>> header located near the end of the flattened file.
> Thank you for the patch, I found a vmcore that reproduced the issue:
>
> $ makedumpfile -FEd 31 vmcore > dump.FEd31
> $ crash vmlinux dump.FEd31
> ...
> realloc: No such file or directory
> cannot realloc resized ELF header buffer
> $
>
> and the patch fixed this, so
>
> Acked-by: Kazuhito Hagio <k-hagio-ab@nec.com>
>
> (Masa will apply the patch, please wait for a while.)
>
> Thanks,
> Kazu
>
>
>> Fixes: e39216fce9f73759509ec158e39c289e6c211125 ("Make the incomplete dumpfile generated by ENOSPC error analyzable.")
>> Signed-off-by: Jiri Bohac <jbohac@suse.cz>
>>
>> ---
>> makedumpfile.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/makedumpfile.c b/makedumpfile.c
>> index cadc596..9624c3f 100644
>> --- a/makedumpfile.c
>> +++ b/makedumpfile.c
>> @@ -5206,6 +5206,9 @@ reserve_diskspace(int fd, off_t start_offset, off_t end_offset, char *file_name)
>>
>> int ret = FALSE;
>>
>> + if (info->flag_flatten)
>> + return TRUE;
>> +
>> assert(start_offset < end_offset);
>> buf_size = end_offset - start_offset;
>>
Thank you, Jiri, for the patch. Sorry for the late apply the patch.
https://github.com/makedumpfile/makedumpfile/commit/c76301277552b95b613ffe9d5a211d01df73bd79
Thanks,
Masa
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
prev parent reply other threads:[~2024-08-06 9:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 12:04 [PATCH] makedumpfile: make reserve_diskspace do nothing for flattened format Jiri Bohac
2024-07-19 8:00 ` HAGIO KAZUHITO(萩尾 一仁)
2024-08-06 9:02 ` YAMAZAKI MASAMITSU(山崎 真光) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=99a146b3-bf8d-4de2-9d9c-0abcc705b3a6@nec.com \
--to=yamazaki-msmt@nec.com \
--cc=jbohac@suse.cz \
--cc=k-hagio-ab@nec.com \
--cc=kexec@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox