Try to rewind mmap_next_start when unmapping memory. Simple tests in test-mmap.c now pass.
Best regards -- Edgar E. Iglesias Axis Communications AB diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 6292826..78a8162 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -385,6 +385,9 @@ int target_munmap(abi_ulong start, abi_ulong len) real_end -= qemu_host_page_size; } + if (start < mmap_next_start) + mmap_next_start = start; + /* unmap what we can */ if (real_start < real_end) { ret = munmap(g2h(real_start), real_end - real_start);