qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: qemu-devel@nongnu.org
Cc: Max Filippov <jcmvbkbc@gmail.com>,
	qemu-stable@nongnu.org, Riku Voipio <riku.voipio@iki.fi>,
	Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PATCH v2 06/11] linux-user: fix assertion in shmdt
Date: Wed, 28 Feb 2018 14:16:04 -0800	[thread overview]
Message-ID: <20180228221609.11265-7-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <20180228221609.11265-1-jcmvbkbc@gmail.com>

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: Max Filippov <jcmvbkbc@gmail.com>
---
 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

  parent reply	other threads:[~2018-02-28 22:16 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 22:15 [Qemu-devel] [PATCH v2 00/11] linux-user support for target/xtensa Max Filippov
2018-02-28 22:15 ` [Qemu-devel] [PATCH v2 01/11] target/xtensa: dump correct physical registers Max Filippov
2018-02-28 22:16 ` [Qemu-devel] [PATCH v2 02/11] target/xtensa: mark register windows in the dump Max Filippov
2018-02-28 22:16 ` [Qemu-devel] [PATCH v2 03/11] target/xtensa: use correct number of registers in gdbstub Max Filippov
2018-02-28 22:16 ` [Qemu-devel] [PATCH v2 04/11] target/xtensa: support MTTCG Max Filippov
2018-02-28 22:16 ` [Qemu-devel] [PATCH v2 05/11] linux-user: fix mmap/munmap/mprotect/mremap/shmat Max Filippov
2018-02-28 22:16 ` Max Filippov [this message]
2018-03-01 10:14   ` [Qemu-devel] [PATCH v2 06/11] linux-user: fix assertion in shmdt Laurent Vivier
2018-03-09 19:57   ` Laurent Vivier
2018-02-28 22:16 ` [Qemu-devel] [PATCH v2 07/11] linux-user: fix target_mprotect/target_munmap error return values Max Filippov
2018-03-01  9:42   ` Laurent Vivier
2018-03-09 19:57   ` Laurent Vivier
2018-02-28 22:16 ` [Qemu-devel] [PATCH v2 08/11] linux-user: drop unused target_msync function Max Filippov
2018-03-01  9:28   ` Laurent Vivier
2018-03-09 19:58   ` Laurent Vivier
2018-02-28 22:16 ` [Qemu-devel] [PATCH v2 09/11] target/xtensa: add linux-user support Max Filippov
2018-02-28 22:16 ` [Qemu-devel] [PATCH v2 10/11] qemu-binfmt-conf.sh: add qemu-xtensa Max Filippov
2018-03-01 14:13   ` Laurent Vivier
2018-03-09 19:58   ` Laurent Vivier
2018-03-09 20:55     ` Max Filippov
2018-02-28 22:16 ` [Qemu-devel] [PATCH v2 11/11] MAINTAINERS: fix W: address for xtensa Max Filippov
2018-02-28 22:29 ` [Qemu-devel] [PATCH v2 00/11] linux-user support for target/xtensa no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180228221609.11265-7-jcmvbkbc@gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).