diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2018-02-27 14:52:25 -0800 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2018-03-13 11:30:22 -0700 |
commit | 21b869a321871728077a5d0469a05f0d34041650 (patch) | |
tree | d6962dde1e3f473f370fb4b2207d0e7591c0dfc5 /linux-user | |
parent | e530acd7de8178ca1eb30ac4c19508e6f68a172d (diff) |
linux-user: fix assertion in shmdt
shmdt fails to call mmap_lock/mmap_unlock around page_set_flags,
resulting in the following assertion:
page_set_flags: Assertion `have_mmap_lock()' failed.
Wrap shmdt internals into mmap_lock/mmap_unlock.
Cc: qemu-stable@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'linux-user')
-rw-r--r-- | linux-user/syscall.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 9cba25dc88..19d5445c31 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4947,6 +4947,9 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env, static inline abi_long do_shmdt(abi_ulong shmaddr) { int i; + abi_long rv; + + mmap_lock(); for (i = 0; i < N_SHM_REGIONS; ++i) { if (shm_regions[i].in_use && shm_regions[i].start == shmaddr) { @@ -4955,8 +4958,11 @@ static inline abi_long do_shmdt(abi_ulong shmaddr) break; } } + rv = get_errno(shmdt(g2h(shmaddr))); + + mmap_unlock(); - return get_errno(shmdt(g2h(shmaddr))); + return rv; } #ifdef TARGET_NR_ipc |