|
From: | Richard Henderson |
Subject: | Re: [PULL 38/47] linux-user: Rename mmap_reserve to mmap_reserve_or_unmap |
Date: | Tue, 3 Oct 2023 14:03:11 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 |
On 9/18/23 01:35, Andreas Schwab wrote:
On Jul 15 2023, Richard Henderson wrote:@@ -776,9 +776,15 @@ static void mmap_reserve(abi_ulong start, abi_ulong len) real_len = real_last - real_start + 1; host_start = g2h_untagged(real_start);- ptr = mmap(host_start, real_len, PROT_NONE,- MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1, 0); - assert(ptr == host_start); + if (reserved_va) { + void *ptr = mmap(host_start, real_len, PROT_NONE, + MAP_FIXED | MAP_ANONYMOUS + | MAP_PRIVATE | MAP_NORESERVE, -1, 0); + assert(ptr == host_start); + } else { + int ret = munmap(host_start, real_len); + assert(ret == 0);munmap can fail if vm.max_map_count is exceeded. See the attached test (must be run from the current directory): $ qemu-riscv64 ./test-free qemu-riscv64: ../linux-user/mmap.c:801: mmap_reserve_or_unmap: Assertion `ret == 0' failed. ** ERROR:../accel/tcg/cpu-exec.c:532:cpu_exec_longjmp_cleanup: assertion failed: (cpu == current_cpu) Bail out! ERROR:../accel/tcg/cpu-exec.c:532:cpu_exec_longjmp_cleanup: assertion failed: (cpu == current_cpu)
Thanks. Sent a fix. r~
[Prev in Thread] | Current Thread | [Next in Thread] |