]> git.proxmox.com Git - qemu.git/commit - linux-user/mmap.c
linux-user: Rewrite mmap_find_vma() to work fine on 64-bit hosts with 32-bit targets
authorKirill A. Shutemov <kirill@shutemov.name>
Thu, 13 Aug 2009 18:03:58 +0000 (21:03 +0300)
committerRiku Voipio <riku.voipio@iki.fi>
Tue, 25 Aug 2009 14:15:35 +0000 (17:15 +0300)
commitfe3b415231ee66f4a3712e5e601a19096403886b
tree32d1986946038fb31ac7c3a19443ced9acd56ff1
parent12727917db45aebb809e4b09c51e883c09a6366f
linux-user: Rewrite mmap_find_vma() to work fine on 64-bit hosts with 32-bit targets

qemu's page table can be incomple if /proc/self/maps is unavailable or
host allocating a memory with mmap(), so we can't use it to find free
memory area.

New version mmap_find_vma() uses mmap() without MAP_FIXED to find free
memory.

Tested-by: Martin Mohring <martin.mohring@opensuse.org> :
quite some time ago this patch had been sent by Kirill to the QEMU ml.
At that time, the patch was rejected. Now we found out why the current
user mode memory allocator sometimes fails:

- Kernel Bug  linux/fs/proc/task_mmu.c (fixed after 2.6.27)
http://bugzilla.kernel.org/attachment.cgi?id=17219
- use of proc file system to find memory mappings => bad idea

So I please apply the attached patch from Kirill to qemu to fix this
longstanding bug, because it causes all older linux distros (using
kernel 2.6.26 or older) to fail the QEMU memory allocator in user mode.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
linux-user/mmap.c