[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/17] linux-user/mmap.c: Always zero MAP_ANONYMOUS m
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL 11/17] linux-user/mmap.c: Always zero MAP_ANONYMOUS memory in mmap_frag() |
Date: |
Mon, 11 Jan 2016 16:16:13 +0200 |
From: Chen Gang <address@hidden>
When mapping MAP_ANONYMOUS memory fragments, still need notice about to
set it zero, or it will cause issues.
Signed-off-by: Chen Gang <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/mmap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 7b459d5..c6c478e 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -186,10 +186,12 @@ static int mmap_frag(abi_ulong real_start,
if (prot_new != (prot1 | PROT_WRITE))
mprotect(host_start, qemu_host_page_size, prot_new);
} else {
- /* just update the protection */
if (prot_new != prot1) {
mprotect(host_start, qemu_host_page_size, prot_new);
}
+ if (prot_new & PROT_WRITE) {
+ memset(g2h(start), 0, end - start);
+ }
}
return 0;
}
--
2.6.4
- [Qemu-devel] [PULL 00/17] linux-user queque, riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 01/17] linux-user: add signalfd/signalfd4 syscalls, riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 06/17] linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure fields accordingly, riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 04/17] linux-user/syscall.c: malloc()/calloc() to g_malloc()/g_try_malloc()/g_new0(), riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 05/17] linux-user: SOCK_PACKET uses network endian to encode protocol in socket(), riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 03/17] linux-user: in poll(), if nfds is 0, pfd can be NULL, riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 02/17] linux-user: correctly align target_epoll_event, riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 08/17] linux-user: manage bind with a socket of SOCK_PACKET type., riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 17/17] linux-user/mmap.c: Use end instead of real_end in target_mmap, riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 11/17] linux-user/mmap.c: Always zero MAP_ANONYMOUS memory in mmap_frag(),
riku . voipio <=
- [Qemu-devel] [PULL 07/17] linux-user: add a function hook to translate sockaddr, riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 14/17] linux-user/syscall.c: Use SOL_SOCKET instead of level for setsockopt(), riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 15/17] linux-user: Update m68k syscall definitions to match Linux 4.4., riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 10/17] linux-user, sh4: fix signal retcode address, riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 09/17] linux-user: check fd is >= 0 in fd_trans_host_to_target_data/fd_trans_host_to_target_addr, riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 13/17] linux-user: enable sigaltstack for all architectures, riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 12/17] unicore32: convert get_sp_from_cpustate from macro to inline, riku . voipio, 2016/01/11
- [Qemu-devel] [PULL 16/17] linux-user: Add SOCKOP_sendmmsg and SOCKOP_recvmmsg socket call, wire them up., riku . voipio, 2016/01/11
- Re: [Qemu-devel] [PULL 00/17] linux-user queque, Peter Maydell, 2016/01/11