From nobody Wed Oct 22 06:13:37 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519856342979340.0927100600825; Wed, 28 Feb 2018 14:19:02 -0800 (PST) Received: from localhost ([::1]:47323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erA3x-0004vn-NL for importer@patchew.org; Wed, 28 Feb 2018 17:19:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erA1g-0003Lb-C7 for qemu-devel@nongnu.org; Wed, 28 Feb 2018 17:16:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erA1b-0003JN-RH for qemu-devel@nongnu.org; Wed, 28 Feb 2018 17:16:40 -0500 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:37408) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1erA1b-0003HS-Ed; Wed, 28 Feb 2018 17:16:35 -0500 Received: by mail-lf0-x241.google.com with SMTP id y19so5879638lfd.4; Wed, 28 Feb 2018 14:16:35 -0800 (PST) Received: from octofox.cadence.com (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id s82sm566984lja.7.2018.02.28.14.16.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 14:16:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mN9uP3ViiMufF3xuAxqZlaEhTqcuM/v/6Zil1g/KPYM=; b=itSrKVvIAqnGf6HIY0XzjNss5I5tkd2MrTvFH6UYeY6+wIf4eakZK0mz/4iiXwrCnM GB+/kbY7v1i/qgrc6OSDxYMQexTd1+bvlEiOqRuAC6xzwyKN3RhnnhTBnzx4G7pJirQl uyNig1lNxEstbkQiFL2/JSrYq8ksX1De9QDeb3ue4UfLmPU9OYFIoXkFjXyJ53+cfn3o AYusx1TiFRqVPDNuoYeaX0GO66a+4KzwuTe2ylX5rr7Ac2FsHw1XxKswDxXxFuonyAbt uk6rBWTXQVZ9c+oOu3evddXHzknQOyUMBQqCbUVcMWmJmlFKgh/9duN3ZDByoOdpvw/O 53hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mN9uP3ViiMufF3xuAxqZlaEhTqcuM/v/6Zil1g/KPYM=; b=HXdm+mJo9btggTCKhIBRuuaBakPvXljEslltQv51kqItboVJKBsq/jGIDEMaQPxq7F AgIunghfLwK9bnIL0jlFDRdYRaBe1iW3q7X/7wMb+jmZpj1zBqy4XH6ryGDSPUorFKM2 5Pvzh3hrQyHwVCHYqXiJf+XEWK3ErIiQLc2j9ySISMcGXC1erMBs/w2HYy20K0c0cUiC fKFIFKDoyvj9a5DM/cdFJkMiqM8O5Dq+ylmvyrXsrRqoFt89JQzNRs3DJauqRPNsAJMY ieK5lkgt9NxtV22nMC/SrpA8CAxNFob3YqFB3tdstyd//HCLe8W/YkRxZH0I0BT6MwZs 8U+w== X-Gm-Message-State: APf1xPBhftVTCeWPsAqpLGyQrneyKpl0YU8MpRfAjx/CoqCZPCkr17C2 hd0CAsYe+f0qnWOF68Yct6xtTQ== X-Google-Smtp-Source: AG47ELs4xgi3fpJcf7plx5MbgEOjvGm53qdAr1BwbwfKcfvXz2FpQTR8VwLzi5HSzJBS0MjyFYihmQ== X-Received: by 10.25.198.23 with SMTP id w23mr13647020lff.40.1519856194095; Wed, 28 Feb 2018 14:16:34 -0800 (PST) From: Max Filippov To: qemu-devel@nongnu.org Date: Wed, 28 Feb 2018 14:16:04 -0800 Message-Id: <20180228221609.11265-7-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180228221609.11265-1-jcmvbkbc@gmail.com> References: <20180228221609.11265-1-jcmvbkbc@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::241 Subject: [Qemu-devel] [PATCH v2 06/11] linux-user: fix assertion in shmdt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov , Riku Voipio , qemu-stable@nongnu.org, Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Cc: Laurent Vivier Signed-off-by: Max Filippov Reviewed-by: Laurent Vivier --- 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_en= v, static inline abi_long do_shmdt(abi_ulong shmaddr) { int i; + abi_long rv; + + mmap_lock(); =20 for (i =3D 0; i < N_SHM_REGIONS; ++i) { if (shm_regions[i].in_use && shm_regions[i].start =3D=3D shmaddr) { @@ -4955,8 +4958,11 @@ static inline abi_long do_shmdt(abi_ulong shmaddr) break; } } + rv =3D get_errno(shmdt(g2h(shmaddr))); + + mmap_unlock(); =20 - return get_errno(shmdt(g2h(shmaddr))); + return rv; } =20 #ifdef TARGET_NR_ipc --=20 2.11.0