[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/11] linux-user: fix assertion in shmdt
From: |
Max Filippov |
Subject: |
[Qemu-devel] [PATCH 06/11] linux-user: fix assertion in shmdt |
Date: |
Wed, 28 Feb 2018 13:06:11 -0800 |
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: address@hidden
Cc: Riku Voipio <address@hidden>
Cc: Laurent Vivier <address@hidden>
Signed-off-by: Max Filippov <address@hidden>
---
linux-user/syscall.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 79245e73784f..595b26fdd8f3 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
--
2.11.0
- [Qemu-devel] [PATCH 00/11] linux-user support for target/xtensa, Max Filippov, 2018/02/28
- [Qemu-devel] [PATCH 01/11] target/xtensa: dump correct physical registers, Max Filippov, 2018/02/28
- [Qemu-devel] [PATCH 02/11] target/xtensa: mark register windows in the dump, Max Filippov, 2018/02/28
- [Qemu-devel] [PATCH 03/11] target/xtensa: use correct number of registers in gdbstub, Max Filippov, 2018/02/28
- [Qemu-devel] [PATCH 04/11] target/xtensa: support MTTCG, Max Filippov, 2018/02/28
- [Qemu-devel] [PATCH 05/11] linux-user: fix mmap/munmap/mprotect/mremap/shmat, Max Filippov, 2018/02/28
- [Qemu-devel] [PATCH 06/11] linux-user: fix assertion in shmdt,
Max Filippov <=
- [Qemu-devel] [PATCH 07/11] linux-user: fix target_mprotect/target_munmap error return values, Max Filippov, 2018/02/28
- [Qemu-devel] [PATCH 08/11] linux-user: drop unused target_msync function, Max Filippov, 2018/02/28
- [Qemu-devel] [PATCH 10/11] qemu-binfmt-conf.sh: add qemu-xtensa, Max Filippov, 2018/02/28
- [Qemu-devel] [PATCH 11/11] MAINTAINERS: fix W: address for xtensa, Max Filippov, 2018/02/28
- [Qemu-devel] [PATCH 09/11] target/xtensa: add linux-user support, Max Filippov, 2018/02/28
- Re: [Qemu-devel] [PATCH 00/11] linux-user support for target/xtensa, no-reply, 2018/02/28
- Re: [Qemu-devel] [PATCH 00/11] linux-user support for target/xtensa, no-reply, 2018/02/28