Commit f46e9a0b authored by Tom Musta's avatar Tom Musta Committed by Alexander Graf
Browse files

target-ppc: Confirm That .bss Pages Are Valid



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: default avatarTom Musta <tommusta@gmail.com>
Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
parent 5b274ed7
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1425,9 +1425,10 @@ static void zero_bss(abi_ulong elf_bss, abi_ulong last_bss, int prot)
            perror("cannot mmap brk");
            exit(-1);
        }
    }

        /* Since we didn't use target_mmap, make sure to record
           the validity of the pages with qemu.  */
    /* 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 | PAGE_VALID);
    }