[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [5958] linux-user: mmap: add check if requested memory area
From: |
Aurelien Jarno |
Subject: |
[Qemu-devel] [5958] linux-user: mmap: add check if requested memory area fits target address space |
Date: |
Mon, 08 Dec 2008 18:12:33 +0000 |
Revision: 5958
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5958
Author: aurel32
Date: 2008-12-08 18:12:33 +0000 (Mon, 08 Dec 2008)
Log Message:
-----------
linux-user: mmap: add check if requested memory area fits target address space
Signed-off-by: Kirill A. Shutemov <address@hidden>
Acked-by: Edgar E. Iglesias <address@hidden>
Signed-off-by: Aurelien Jarno <address@hidden>
Modified Paths:
--------------
trunk/linux-user/mmap.c
Modified: trunk/linux-user/mmap.c
===================================================================
--- trunk/linux-user/mmap.c 2008-12-08 18:12:26 UTC (rev 5957)
+++ trunk/linux-user/mmap.c 2008-12-08 18:12:33 UTC (rev 5958)
@@ -382,6 +382,16 @@
end = start + len;
real_end = HOST_PAGE_ALIGN(end);
+ /*
+ * Test if requested memory area fits target address space
+ * It can fail only on 64-bit host with 32-bit target.
+ * On any other target/host host mmap() handles this error correctly.
+ */
+ if ((unsigned long)start + len - 1 > (abi_ulong) -1) {
+ errno = EINVAL;
+ goto fail;
+ }
+
for(addr = real_start; addr < real_end; addr += TARGET_PAGE_SIZE) {
flg = page_get_flags(addr);
if (flg & PAGE_RESERVED) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [5958] linux-user: mmap: add check if requested memory area fits target address space,
Aurelien Jarno <=