qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: patches@linaro.org, Paolo Bonzini <pbonzini@redhat.com>,
	Jean-Christophe DUBOIS <jcd@tribudubois.net>
Subject: [Qemu-devel] [PATCH for-2.7 0/3] Add memory_region_init_rom() and use to fix imx board crashes
Date: Tue, 28 Jun 2016 14:58:04 +0100	[thread overview]
Message-ID: <1467122287-24974-1-git-send-email-peter.maydell@linaro.org> (raw)

    
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

             reply	other threads:[~2016-06-28 14:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-28 13:58 Peter Maydell [this message]
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

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=1467122287-24974-1-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=jcd@tribudubois.net \
    --cc=patches@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).