From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Bin Meng <bmeng@tinylab.org>,
qemu-devel@nongnu.org,
Richard Henderson <richard.henderson@linaro.org>,
Thomas Huth <thuth@redhat.com>
Subject: Re: [PATCH] hw/elf_ops: Ignore loadable segments with zero size
Date: Wed, 17 Jan 2024 09:18:38 +0100 [thread overview]
Message-ID: <ef36646f-fed5-4b46-8542-44100b9d58bb@linaro.org> (raw)
In-Reply-To: <20240116155049.390301-1-bmeng@tinylab.org>
On 16/1/24 16:50, Bin Meng wrote:
> Some ELF files really do have segments of zero size, e.g.:
>
> Program Headers:
> Type Offset VirtAddr PhysAddr
> FileSiz MemSiz Flags Align
> RISCV_ATTRIBUT 0x00000000000025b8 0x0000000000000000 0x0000000000000000
> 0x000000000000003e 0x0000000000000000 R 0x1
> LOAD 0x0000000000001000 0x0000000080200000 0x0000000080200000
> 0x00000000000001d1 0x00000000000001d1 R E 0x1000
> LOAD 0x00000000000011d1 0x00000000802001d1 0x00000000802001d1
> 0x0000000000000e37 0x0000000000000e37 RW 0x1000
> LOAD 0x0000000000000120 0x0000000000000000 0x0000000000000000
> 0x0000000000000000 0x0000000000000000 0x1000
>
> The current logic does not check for this condition, resulting in
> the incorrect assignment of 'lowaddr' as zero.
>
> There is already a piece of codes inside the segment traversal loop
> that checks for zero-sized loadable segments for not creating empty
> ROM blobs. Let's move this check to the beginning of the loop to
> cover both scenarios.
>
> Signed-off-by: Bin Meng <bmeng@tinylab.org>
> ---
>
> include/hw/elf_ops.h | 75 +++++++++++++++++++++++---------------------
> 1 file changed, 39 insertions(+), 36 deletions(-)
Thanks, patch queued.
prev parent reply other threads:[~2024-01-17 8:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-16 15:50 [PATCH] hw/elf_ops: Ignore loadable segments with zero size Bin Meng
2024-01-16 16:38 ` Richard Henderson
2024-01-20 10:28 ` Michael Tokarev
2024-01-20 21:25 ` Richard Henderson
2024-01-17 8:18 ` Philippe Mathieu-Daudé [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=ef36646f-fed5-4b46-8542-44100b9d58bb@linaro.org \
--to=philmd@linaro.org \
--cc=bmeng@tinylab.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).