[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] mmap: add check if requested memory area fits targe
From: |
Kirill A. Shutemov |
Subject: |
[Qemu-devel] [PATCH] mmap: add check if requested memory area fits target address space |
Date: |
Wed, 3 Dec 2008 13:29:43 +0200 |
Signed-off-by: Kirill A. Shutemov <address@hidden>
---
linux-user/mmap.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index d96917d..52e2dc8 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -389,6 +389,16 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int
prot,
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) {
--
1.6.0.2.GIT
- [Qemu-devel] [PATCH] Introduce --enable-binfmt-misc configure option, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] Fix fstatat64()/newfstatat() syscall implementation, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] Move abi_* typedefs into qemu-types.h, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] linux-user: Safety belt for h2g, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] linux-user: Introduce h2g_valid, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] linux-user: Fix h2g usage in page_find_alloc, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] Rewrite mmap_find_vma() to work fine on 64-bit hosts with 32-bit targets, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] mmap: add check if requested memory area fits target address space,
Kirill A. Shutemov <=
- [Qemu-devel] [PATCH] mremap(): handle MREMAP_FIXED and MREMAP_MAYMOVE correctly, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] Fix and cleanup IPCOP_sem* ipc calls handling, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] Implement sem* syscalls, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] Fix and cleanup IPCOP_shm* ipc calls handling, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] Implement shm* syscalls, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] shmat(): use mmap_find_vma to find free memory area, Kirill A. Shutemov, 2008/12/03
- Re: [Qemu-devel] [PATCH] mremap(): handle MREMAP_FIXED and MREMAP_MAYMOVE correctly, Edgar E. Iglesias, 2008/12/06
- Re: [Qemu-devel] [PATCH] mremap(): handle MREMAP_FIXED and MREMAP_MAYMOVE correctly, Kirill A. Shutemov, 2008/12/06
- Re: [Qemu-devel] [PATCH] mremap(): handle MREMAP_FIXED and MREMAP_MAYMOVE correctly, Aurelien Jarno, 2008/12/08
- Re: [Qemu-devel] [PATCH] mmap: add check if requested memory area fits target address space, Edgar E. Iglesias, 2008/12/06