From nobody Tue Feb 10 00:22:54 2026 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=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1517860210895121.60576632228481; Mon, 5 Feb 2018 11:50:10 -0800 (PST) Received: from localhost ([::1]:54899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eimm9-0006ng-Jy for importer@patchew.org; Mon, 05 Feb 2018 14:50:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eimST-0004f7-F4 for qemu-devel@nongnu.org; Mon, 05 Feb 2018 14:29:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eimSS-00055R-F2 for qemu-devel@nongnu.org; Mon, 05 Feb 2018 14:29:41 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:44261) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eimSS-000559-7n for qemu-devel@nongnu.org; Mon, 05 Feb 2018 14:29:40 -0500 Received: by mail-wr0-x244.google.com with SMTP id v31so30823550wrc.11 for ; Mon, 05 Feb 2018 11:29:40 -0800 (PST) Received: from 640k.lan ([82.84.122.246]) by smtp.gmail.com with ESMTPSA id g8sm20029891wra.18.2018.02.05.11.29.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Feb 2018 11:29:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=MP54IJI95co9B4VzCAdbd2nkHR3OwYYVcYo5SiJ80RU=; b=ciF74+dkuM/cRX//6YR4LXIpYKuUQ/cslgtQaffoM00E56gOfW2Dz8spS9JH8/BiiI /c+rActoA8E7awzj1ExYzf2Cd8lkLAIhXLyj/rAaKDOl7a3cDBatydEBiXqPRjlPAfVT 1S7INM7a3r+Tf3oZWE1q+XETKWStmFN1C4abuSzvtqaRvqICr7FUO1BdRsFBTvQKbI58 TXYguvWYIbMyokX7JC76VAtL0s0t/hdhw0UL9nh21hdsUTXdxhAYx06B669uhXKxy2mk FxAlyhrF+3j15UWgD0RKtMSjh/ZeFUHBv999sBvioH3bwKAWl3onHlPdMOWiCS17REQM 9+fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=MP54IJI95co9B4VzCAdbd2nkHR3OwYYVcYo5SiJ80RU=; b=Mcy1Ed/xTJUWWGqBz9dRNPUkOcx35lvQnaR1hMD9Tge6hWryiObKx3uTEDvHtc2xzE e1TEvKnQfeXZouLqZpEfJWlQ2mFykql/7g/TSMlVy0sVQdrVarqqV+vAVThGi8jOZBiP 15eXKJlfmN6oJFP6rNYtEylQdrHSlmjwT8tSH5i4m9TpNN3bBT+QNzggj0TGYBojWDM7 8ziN3SbOhwID64O/1Vb5gH9iFR18Dd6qI2pynMWDaqxapfgcyT9cWd7gQeGrHVUwkqVU FMIVwv1Wj7RnDyhIqiDoejv00WJkxS6Y/3d8Zx5YibGcDe/MxFK52dFgz7qfMtZ9k6hm iMeA== X-Gm-Message-State: AKwxytfZbyfCOSuJJVR3C37I1KwmJJ2v9vfqwlOWh6wpgeGzcjRcprN4 G3rP895E1tar8nw8C1oNtsevMy8w X-Google-Smtp-Source: AH8x227LsJMIwGoEC0a99pCeMGKG875NqazaL/+yvanfyaWTA2qV5ph+Yr/qyNivthQs7t0QxVYv6w== X-Received: by 10.223.199.71 with SMTP id b7mr12289981wrh.89.1517858978909; Mon, 05 Feb 2018 11:29:38 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 5 Feb 2018 20:28:43 +0100 Message-Id: <1517858941-5538-30-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517858941-5538-1-git-send-email-pbonzini@redhat.com> References: <1517858941-5538-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 29/47] ivshmem: Disable irqfd on device reset 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: Ladi Prosek 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" From: Ladi Prosek The effects of ivshmem_enable_irqfd() was not undone on device reset. This manifested as: ivshmem_add_kvm_msi_virq: Assertion `!s->msi_vectors[vector].pdev' failed. when irqfd was enabled before reset and then enabled again after reset, mak= ing ivshmem_enable_irqfd() run for the second time. To reproduce, run: ivshmem-server and QEMU with: -device ivshmem-doorbell,chardev=3Div -chardev socket,path=3D/tmp/ivshmem_socket,id=3Div then install the Windows driver, at the time of writing available at: https://github.com/virtio-win/kvm-guest-drivers-windows/tree/master/ivshmem and crash-reboot the guest by inducing a BSOD. Signed-off-by: Ladi Prosek Message-Id: <20171211072110.9058-5-lprosek@redhat.com> Signed-off-by: Paolo Bonzini --- hw/misc/ivshmem.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index fe1d8d1..16f0370 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -757,10 +757,14 @@ static void ivshmem_msix_vector_use(IVShmemState *s) } } =20 +static void ivshmem_disable_irqfd(IVShmemState *s); + static void ivshmem_reset(DeviceState *d) { IVShmemState *s =3D IVSHMEM_COMMON(d); =20 + ivshmem_disable_irqfd(s); + s->intrstatus =3D 0; s->intrmask =3D 0; if (ivshmem_has_feature(s, IVSHMEM_MSI)) { --=20 1.8.3.1