From patchwork Tue Sep 14 05:22:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: linux-user: mmap_reserve() not controlled by RESERVED_VA From: amateur X-Patchwork-Id: 64672 Message-Id: <20100914052234.GA10008@localdomain> To: Qemu Devel Date: Tue, 14 Sep 2010 13:22:34 +0800 mmap_reserve() should be called only when RESERVED_VA is enabled. Otherwise, unmaped virtual address space will never be reusable. This bug will exhaust virtual address space in extreme conditions. diff --git a/linux-user/mmap.c b/linux-user/mmap.c index e10a6ef..50748a2 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -697,7 +697,9 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, old_size, new_size, flags | MREMAP_FIXED, g2h(mmap_start)); - mmap_reserve(old_addr, old_size); + if ( RESERVED_VA ) { + mmap_reserve(old_addr, old_size); + } } } else { int prot = 0;