From: Gleb Natapov <gleb@redhat.com>
To: qemu-devel@nongnu.org
Cc: kvm@vger.kernel.org
Subject: [Qemu-devel] Re: [PATCH 1/2] Fix segfault in mmio subpage handling code.
Date: Thu, 29 Jul 2010 13:41:45 +0300 [thread overview]
Message-ID: <20100729104145.GA24773@redhat.com> (raw)
In-Reply-To: <1280330003-1467-2-git-send-email-gleb@redhat.com>
Use this one instead.
On Wed, Jul 28, 2010 at 06:13:22PM +0300, Gleb Natapov wrote:
> It is possible that subpage mmio is registered over existing memory
> page. When this happens "memory" will have real memory address and not
> index into io_mem array so next access to the page will generate
> segfault. It is uncommon to have some part of a page to be accessed as
> memory and some as mmio, but qemu shouldn't crash even when guest does
> stupid things. So lets just pretend that the rest of the page is
> unassigned if guest configure part of the memory page as mmio.
>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/exec.c b/exec.c
index 5e9a5b7..53483bc 100644
--- a/exec.c
+++ b/exec.c
@@ -3362,6 +3362,8 @@ static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
printf("%s: %p start %08x end %08x idx %08x eidx %08x mem %ld\n", __func__,
mmio, start, end, idx, eidx, memory);
#endif
+ if ((memory & ~TARGET_PAGE_MASK) == IO_MEM_RAM)
+ memory = IO_MEM_UNASSIGNED;
memory = (memory >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
for (; idx <= eidx; idx++) {
mmio->sub_io_index[idx] = memory;
--
Gleb.
next prev parent reply other threads:[~2010-07-29 10:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-28 15:13 [Qemu-devel] [PATCH 0/2] cpu_register_physical_memory() is completely broken Gleb Natapov
2010-07-28 15:13 ` [Qemu-devel] [PATCH 1/2] Fix segfault in mmio subpage handling code Gleb Natapov
2010-07-29 10:41 ` Gleb Natapov [this message]
2010-07-29 21:16 ` [Qemu-devel] " Marcelo Tosatti
2010-08-28 8:49 ` Blue Swirl
2010-07-28 15:13 ` [Qemu-devel] [PATCH 2/2] Remove guest triggerable abort() Gleb Natapov
2010-07-29 21:18 ` [Qemu-devel] " Marcelo Tosatti
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=20100729104145.GA24773@redhat.com \
--to=gleb@redhat.com \
--cc=kvm@vger.kernel.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).