* [Qemu-devel] [5958] linux-user: mmap: add check if requested memory area fits target address space
@ 2008-12-08 18:12 Aurelien Jarno
0 siblings, 0 replies; only message in thread
From: Aurelien Jarno @ 2008-12-08 18:12 UTC (permalink / raw)
To: qemu-devel
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 <kirill@shutemov.name>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
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) {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-12-08 18:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-08 18:12 [Qemu-devel] [5958] linux-user: mmap: add check if requested memory area fits target address space Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).