qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.7 0/3] Add memory_region_init_rom() and use to fix imx board crashes
@ 2016-06-28 13:58 Peter Maydell
  2016-06-28 13:58 ` [Qemu-devel] [PATCH for-2.7 1/3] memory: Provide memory_region_init_rom() Peter Maydell
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Peter Maydell @ 2016-06-28 13:58 UTC (permalink / raw)
  To: qemu-arm, qemu-devel; +Cc: patches, Paolo Bonzini, Jean-Christophe DUBOIS

    
The imx boards were all incorrectly creating ROMs using
memory_region_init_rom_device() with a NULL ops pointer.  This will
cause QEMU to abort if the guest tries to write to the ROM.  The way
we currently provide for "create a pure ROM" is to use
memory_region_init_ram() followed by memory_region_set_readonly(),
but this is a bit obscure. So provide a new memory_region_init_rom()
which does the equivalent of those two calls, and use it in
the imx boards.

We can then add an assert() in memory_region_init_rom_device()
to prevent further misuse. (Passing NULL was documented as
"I/O space is not supposed to be handled by QEMU itself", but this
doesn't make much sense (who would be handling the writes?) and
isn't used by any of the callers.)

This is for-2.7 because it fixes a crash in the imx boards
if the guest misbehaves:
https://bugs.launchpad.net/qemu/+bug/1596160

thanks
-- PMM

Peter Maydell (3):
  memory: Provide memory_region_init_rom()
  imx: Use memory_region_init_rom() for ROMs
  memory: Assert that memory_region_init_rom_device() ops aren't NULL

 docs/memory.txt       |  9 +++++++--
 hw/arm/fsl-imx25.c    |  8 ++++----
 hw/arm/fsl-imx31.c    |  9 ++++-----
 hw/arm/fsl-imx6.c     |  8 ++++----
 include/exec/memory.h | 24 ++++++++++++++++++++----
 memory.c              | 16 ++++++++++++++++
 6 files changed, 55 insertions(+), 19 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-06-28 18:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-28 13:58 [Qemu-devel] [PATCH for-2.7 0/3] Add memory_region_init_rom() and use to fix imx board crashes Peter Maydell
2016-06-28 13:58 ` [Qemu-devel] [PATCH for-2.7 1/3] memory: Provide memory_region_init_rom() Peter Maydell
2016-06-28 13:58 ` [Qemu-devel] [PATCH for-2.7 2/3] imx: Use memory_region_init_rom() for ROMs Peter Maydell
2016-06-28 13:58 ` [Qemu-devel] [PATCH for-2.7 3/3] memory: Assert that memory_region_init_rom_device() ops aren't NULL Peter Maydell
2016-06-28 17:53 ` [Qemu-devel] [PATCH for-2.7 0/3] Add memory_region_init_rom() and use to fix imx board crashes Paolo Bonzini
2016-06-28 18:10   ` Cédric Le Goater

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).