[Top][All Lists]

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

[Qemu-devel] [V4 PATCH 5/6] target-ppc: Confirm That .bss Pages Are Vali

From: Tom Musta
Subject: [Qemu-devel] [V4 PATCH 5/6] target-ppc: Confirm That .bss Pages Are Valid
Date: Wed, 28 May 2014 15:34:28 -0500

The existing code does a check to ensure that a .bss region is properly
mmap'd.  When additional mmap is required, the (guest) pages are also
validated.  However, this code has a bug: when host page size is larger
than target page size, it is possible for the .bss pages to already be
(host) mapped but the guest .bss pages may not be valid.

The check to mmap additional space is separated from the flagging of the
target (guest) pages, thus ensuring that both aspects are done properly.

Signed-off-by: Tom Musta <address@hidden>

V3: new patch

 linux-user/elfload.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index def9698..0af6292 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1418,10 +1418,11 @@ static void zero_bss(abi_ulong elf_bss, abi_ulong 
last_bss, int prot)
             perror("cannot mmap brk");
+    }
-        /* Since we didn't use target_mmap, make sure to record
-           the validity of the pages with qemu.  */
-        page_set_flags(elf_bss & TARGET_PAGE_MASK, last_bss, prot|PAGE_VALID);
+    /* Ensure that the bss page(s) are valid */
+    if ((page_get_flags(last_bss-1) & prot) != prot) {
+        page_set_flags(elf_bss & TARGET_PAGE_MASK, last_bss, prot | 
     if (host_start < host_map_start) {

reply via email to

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