qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw/elf_ops: Ignore loadable segments with zero size


From: Richard Henderson
Subject: Re: [PATCH] hw/elf_ops: Ignore loadable segments with zero size
Date: Wed, 17 Jan 2024 03:38:13 +1100
User-agent: Mozilla Thunderbird

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.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]