[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/18] linux-user: fix assertion in shmdt
From: |
Laurent Vivier |
Subject: |
[Qemu-devel] [PULL 06/18] linux-user: fix assertion in shmdt |
Date: |
Tue, 13 Mar 2018 18:33:43 +0100 |
From: Max Filippov <address@hidden>
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>
Reviewed-by: Laurent Vivier <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Laurent Vivier <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 8cbe4499b2..6a38542cb1 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.14.3
- [Qemu-devel] [PULL 00/18] Linux user for 2.12 patches, Laurent Vivier, 2018/03/13
- [Qemu-devel] [PULL 03/18] linux-user: allows to use "--systemd ALL" with qemu-binfmt-conf.sh, Laurent Vivier, 2018/03/13
- [Qemu-devel] [PULL 07/18] linux-user: fix target_mprotect/target_munmap error return values, Laurent Vivier, 2018/03/13
- [Qemu-devel] [PULL 06/18] linux-user: fix assertion in shmdt,
Laurent Vivier <=
- [Qemu-devel] [PULL 05/18] linux-user: fix mmap/munmap/mprotect/mremap/shmat, Laurent Vivier, 2018/03/13
- [Qemu-devel] [PULL 04/18] linux-user: Support f_flags in statfs when available., Laurent Vivier, 2018/03/13
- [Qemu-devel] [PULL 09/18] qemu-binfmt-conf.sh: add qemu-xtensa, Laurent Vivier, 2018/03/13
- [Qemu-devel] [PULL 02/18] linux-user: Remove the unused "not implemented" signal handling stubs, Laurent Vivier, 2018/03/13
- [Qemu-devel] [PULL 08/18] linux-user: drop unused target_msync function, Laurent Vivier, 2018/03/13
- [Qemu-devel] [PULL 01/18] linux-user: Drop unicore32 code, Laurent Vivier, 2018/03/13
- [Qemu-devel] [PULL 10/18] linux-user: Use #if to only call validate_guest_space for 32-bit ARM target, Laurent Vivier, 2018/03/13
- [Qemu-devel] [PULL 12/18] linux-user: init_guest_space: Clean up if we can't initialize the commpage, Laurent Vivier, 2018/03/13
- [Qemu-devel] [PULL 17/18] linux-user: init_guest_space: Don't try to align if we'll reject it, Laurent Vivier, 2018/03/13
- [Qemu-devel] [PULL 14/18] linux-user: init_guest_space: Clarify page alignment logic, Laurent Vivier, 2018/03/13