qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Michael Tokarev <mjt@tls.msk.ru>, Bin Meng <bmeng@tinylab.org>,
	qemu-devel@nongnu.org, Thomas Huth <thuth@redhat.com>
Subject: Re: [PATCH] hw/elf_ops: Ignore loadable segments with zero size
Date: Sun, 21 Jan 2024 08:25:14 +1100	[thread overview]
Message-ID: <ef87ae55-574b-461c-a3ff-f0e1263277bd@linaro.org> (raw)
In-Reply-To: <45c13c08-c539-4daf-892e-db2e9360a186@tls.msk.ru>

On 1/20/24 21:28, Michael Tokarev wrote:
> 16.01.2024 19:38, Richard Henderson wrote:
>> On 1/17/24 02: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>
>>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>>
>> But please report this as a bug to whatever tool produced such nonsense.
> 
> I think we've an old bug about this in debian bts, https://bugs.debian.org/919921 .

That's different -- file size == 0, mem size != 0.


r~



  reply	other threads:[~2024-01-20 21:26 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 [this message]
2024-01-17  8:18 ` Philippe Mathieu-Daudé

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=ef87ae55-574b-461c-a3ff-f0e1263277bd@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=bmeng@tinylab.org \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.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).