提交 8fc971ed 编写于 作者: M Max Filippov 提交者: Michael Roth

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>
Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
Reviewed-by: NLaurent Vivier <laurent@vivier.eu>
Message-Id: <20180228221609.11265-7-jcmvbkbc@gmail.com>
Signed-off-by: NLaurent Vivier <laurent@vivier.eu>
(cherry picked from commit 3c5f6a5f)
Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
上级 1801fabd
......@@ -4918,6 +4918,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) {
......@@ -4926,8 +4929,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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册