[PATCH 0/4] Improve reporting of ROM blob overlap errors

Peter Maydell posted 4 patches 3 years, 4 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20201129203923.10622-1-peter.maydell@linaro.org
Maintainers: Paolo Bonzini <pbonzini@redhat.com>
include/hw/elf_ops.h |  5 ++--
hw/core/loader.c     | 67 ++++++++++++++++++++++++++++++++++++--------
softmmu/vl.c         |  1 -
3 files changed, 58 insertions(+), 15 deletions(-)
[PATCH 0/4] Improve reporting of ROM blob overlap errors
Posted by Peter Maydell 3 years, 4 months ago
(This was inspired by a conversation on IRC with a user.)

We report an error if we detect that there's an overlap in guest
memory between two ROM blobs, but the warning is pretty opaque.
Currently it looks like this:

rom: requested regions overlap (rom dtb. free=0x0000000000008000, addr=0x0000000000000000)
qemu-system-aarch64: rom check and register reset failed

which is pretty cryptic and also is missing information that we
could fairly easily tell the user (like the name of both the ROMs
involved in the overlap rather than just one of them...)


After this patchset it looks like:

qemu-system-aarch64: Some ROM regions are overlapping
These ROM regions might have been loaded by direct user request or by default.
They could be BIOS/firmware images, a guest kernel, initrd or some other file loaded into guest memory.
Check whether you intended to load all this guest code, and whether it has been built to load to the correct addresses.

The following two regions overlap (in the cpu-memory-0 address space):
  /home/petmay01/linaro/qemu-misc-tests/ldmia-fault.axf ELF program header segment 0 (addresses 0x0000000000000000 - 0x0000000000008000)
  dtb (addresses 0x0000000000000000 - 0x0000000000100000)

The following two regions overlap (in the cpu-memory-0 address space):
  /home/petmay01/linaro/qemu-misc-tests/bad-psci-call.axf ELF program header segment 1 (addresses 0x0000000040000000 - 0x0000000040000010)
  /home/petmay01/linaro/qemu-misc-tests/bp-test.elf ELF program header segment 0 (addresses 0x0000000040000000 - 0x0000000040000020)



We're still somewhat at the mercy of QEMU code that creates ROM blobs
to give them usefully diagnostic names (in this example, for example
"dtb" is a bit unhelpfully brief -- it's the virt board's "let me put
the autogenerated DTB at the base of RAM" rather than a DTB passed by
the user). I tweaked the names that the ELF loader uses in the last
patch of the series because that's a pretty common source of one of
the ROMs in a conflict.

thanks
-- PMM

Peter Maydell (4):
  hw/core/loader.c: Track last-seen ROM in
    rom_check_and_register_reset()
  hw/core/loader.c: Improve reporting of ROM overlap errors
  elf_ops.h: Don't truncate name of the ROM blobs we create
  elf_ops.h: Be more verbose with ROM blob names

 include/hw/elf_ops.h |  5 ++--
 hw/core/loader.c     | 67 ++++++++++++++++++++++++++++++++++++--------
 softmmu/vl.c         |  1 -
 3 files changed, 58 insertions(+), 15 deletions(-)

-- 
2.20.1


Re: [PATCH 0/4] Improve reporting of ROM blob overlap errors
Posted by Peter Maydell 3 years, 4 months ago
On Sun, 29 Nov 2020 at 20:39, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> (This was inspired by a conversation on IRC with a user.)
>
> We report an error if we detect that there's an overlap in guest
> memory between two ROM blobs, but the warning is pretty opaque.
> Currently it looks like this:
>
> rom: requested regions overlap (rom dtb. free=0x0000000000008000, addr=0x0000000000000000)
> qemu-system-aarch64: rom check and register reset failed
>
> which is pretty cryptic and also is missing information that we
> could fairly easily tell the user (like the name of both the ROMs
> involved in the overlap rather than just one of them...)
>
>
> After this patchset it looks like:
>
> qemu-system-aarch64: Some ROM regions are overlapping
> These ROM regions might have been loaded by direct user request or by default.
> They could be BIOS/firmware images, a guest kernel, initrd or some other file loaded into guest memory.
> Check whether you intended to load all this guest code, and whether it has been built to load to the correct addresses.
>
> The following two regions overlap (in the cpu-memory-0 address space):
>   /home/petmay01/linaro/qemu-misc-tests/ldmia-fault.axf ELF program header segment 0 (addresses 0x0000000000000000 - 0x0000000000008000)
>   dtb (addresses 0x0000000000000000 - 0x0000000000100000)
>
> The following two regions overlap (in the cpu-memory-0 address space):
>   /home/petmay01/linaro/qemu-misc-tests/bad-psci-call.axf ELF program header segment 1 (addresses 0x0000000040000000 - 0x0000000040000010)
>   /home/petmay01/linaro/qemu-misc-tests/bp-test.elf ELF program header segment 0 (addresses 0x0000000040000000 - 0x0000000040000020)
>

I'm going to take this series via target-arm.next.


thanks
-- PMM