From: Ivan Delalande <colona@arista.com>
To: Petr Tesarik <ptesarik@suse.cz>
Cc: Atsushi Kumagai <ats-kumagai@wm.jp.nec.com>,
kexec mailing list <kexec@lists.infradead.org>
Subject: Re: [PATCH 3/3] makedumpfile: Rewrite readpage_elf
Date: Wed, 10 Feb 2016 23:18:17 +0100 [thread overview]
Message-ID: <20160210221817.GJ382@ycc.fr> (raw)
In-Reply-To: <20160210085009.4df4d14d@hananiah.suse.cz>
On Wed, Feb 10, 2016 at 08:50:09AM +0100, Petr Tesarik wrote:
> The current code in readpage_elf (and readpage_elf_parallel) is extremely
> hard to follow. Additionally, it still does not cover all possible cases.
> For example, attempts to read outside of any ELF segment will end up with
> phys_start being 0, frac_head a negative number, interpreted as a large
> positive number by memset() and write past buffer end.
>
> Instead of trying to handle even more "corner cases", I rewrote the
> algorithm from scratch. The basic idea is simple: set a goal to fill the
> page buffer with data, then work towards that goal by:
>
> - filling holes with zeroes (see Note below),
> - p_filesz portions with file data and
> - remaining p_memsz portions again with zeroes.
>
> Repeat this method for each LOAD until the goal is achieved, or an error
> occurs. In most cases, the loop runs only once.
>
> Note: A "hole" is data at a physical address that is not covered by any
> ELF LOAD program header. In other words, the ELF file does not specify
> any data for such a hole (not even zeroes). So, why does makedumpfile
> fill them with zeroes? It's because makedumpfile works with page
> granularity (the compressed format does not even have a way to store
> a partial page), so if only part of a page is stored, a complete page
> must be provided to make this partial data accessible.
>
> Credits to Ivan Delalande <colona@arista.com> who first found the
> problem and wrote the original fix.
>
> Signed-off-by: Petr Tesarik <ptesarik@suse.com>
Tested-by: Ivan Delalande <colona@arista.com>
Dump-dmesg works well and gives the expected results with our various
setups (x86_64 only). Thanks for your work Petr!
--
Ivan "Colona" Delalande
Arista Networks
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2016-02-10 22:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-10 7:47 [PATCH 0/3] makedumpfile: Fix handling of ELF segments with p_memsz > p_filesz Petr Tesarik
2016-02-10 7:49 ` [PATCH 1/3] makedumpfile: Keep segment memory size when re-filtering ELF dumps Petr Tesarik
2016-02-10 7:49 ` [PATCH 2/3] makedumpfile: Mark unstored ELF pages as filtered Petr Tesarik
2016-05-18 7:44 ` Atsushi Kumagai
2016-06-07 4:18 ` Atsushi Kumagai
2016-07-12 21:38 ` Petr Tesarik
2016-07-13 7:43 ` Atsushi Kumagai
2016-02-10 7:50 ` [PATCH 3/3] makedumpfile: Rewrite readpage_elf Petr Tesarik
2016-02-10 22:18 ` Ivan Delalande [this message]
2016-02-17 7:58 ` Atsushi Kumagai
2016-02-29 18:55 ` Petr Tesarik
2016-02-29 18:59 ` [PATCH] makedumpfile: When reading partial ELF pages, check final pointer against buffer end Petr Tesarik
2016-02-29 19:40 ` Petr Tesarik
2016-03-08 11:58 ` [PATCH] makedumpfile: Fix several issues with reading ELF pages Petr Tesarik
2016-03-11 9:16 ` Atsushi Kumagai
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=20160210221817.GJ382@ycc.fr \
--to=colona@arista.com \
--cc=ats-kumagai@wm.jp.nec.com \
--cc=kexec@lists.infradead.org \
--cc=ptesarik@suse.cz \
/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