summaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/elfload.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index d08fc80051..eb8d3adce3 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1425,10 +1425,11 @@ 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. */
- 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 | PAGE_VALID);
}
if (host_start < host_map_start) {