From nobody Sun Dec 14 02:12:33 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1754498436; cv=none; d=zohomail.com; s=zohoarc; b=GNESiF3+ceo+zGAgZHqlJdOXGOQzxHRmtnYs7CdO1uu9aSt8clLd/zCkCfPEaYQuQ7xu8jfpEnm3LNykUrzU3x1L0qicxqNrG/mLJxmexSZ3O/teMriaT1CWqltzLcnjLOntVSeD6vIpKag/OeY6tijErHBzADDqkfgxaYJDt6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1754498436; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TgrchmPCcxWZE5JRTmn1h7oP3WhsqECrwNMByBWHJo4=; b=PlGoIADX0GgxTIQ43/oIgrKe7OTywlUJMHdlV6GSln4XSu4VljMDsdhtO8FV0u+VvrZ1t0P9oo52Hy2qJafEsVir7eDbwAHV1axt8+VsN5HPZ4gKn2Ws+Ulq0mYbbRRlPuudgjAtqDX50ZPrTrrPLSn5AFATHHI1gJFfMfSRmpc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1754498436278697.4912266470142; Wed, 6 Aug 2025 09:40:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ujhAx-0002P5-8R; Wed, 06 Aug 2025 12:39:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ujg5Q-0000Qb-90 for qemu-devel@nongnu.org; Wed, 06 Aug 2025 11:29:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ujg5O-0000Fu-J8 for qemu-devel@nongnu.org; Wed, 06 Aug 2025 11:29:52 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-380-Wq9s8mI_OLuAV94I7HzI3Q-1; Wed, 06 Aug 2025 11:29:46 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E0B651955EC3; Wed, 6 Aug 2025 15:29:44 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.45.225.81]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 449303000198; Wed, 6 Aug 2025 15:29:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1754494188; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=TgrchmPCcxWZE5JRTmn1h7oP3WhsqECrwNMByBWHJo4=; b=LyYJSHrs6jhuT/MSVTWz3A6uyvs6TmwvGJl4TOqEfkgp62p+hRyRcGaRwCmL6XG8wjqhIL 31S4wlGVb212aiR53+uKGsRAAwK7fhVzOvFPPIQ4SY5ZM83hcGS29c3osS52X1PyEpDvtZ CL68Knw+lZyRAZ8Ci4b0nKqHg8q4lNE= X-MC-Unique: Wq9s8mI_OLuAV94I7HzI3Q-1 X-Mimecast-MFC-AGG-ID: Wq9s8mI_OLuAV94I7HzI3Q_1754494185 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Dmitry Fleytman , Jason Wang , Thomas Huth , Akihiko Odaki , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier Subject: [PATCH] e1000e: Prevent crash from legacy interrupt firing after MSI-X enable Date: Wed, 6 Aug 2025 17:29:40 +0200 Message-ID: <20250806152940.362418-1-lvivier@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=lvivier@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1754498439685116600 Content-Type: text/plain; charset="utf-8" A race condition between guest driver actions and QEMU timers can lead to an assertion failure when the guest switches the e1000e from legacy interrupt mode to MSI-X. If a legacy interrupt delay timer (TIDV or RDTR) is active, but the guest enables MSI-X before the timer fires, the pending interrupt cause can trigger an assert in `e1000e_intmgr_collect_delayed_causes()`. The function's assertion (`assert(core->delayed_causes =3D=3D 0)`) incorrectly assumes that it's impossible for a legacy delayed interrupt to be pending once the device is in MSI-X mode. This behavior is incorrect. On a physical device, a driver-initiated mode switch would mask interrupts, reconfigure the hardware, and clear any stale interrupt states. The legacy delay timers (TIDV/RDTR) are not used for moderation in MSI-X mode; the Interrupt Throttle Rate (ITR) mechanism is used instead. Therefore, any pending interrupt from the old mode should be ignored. Replace the overly strict assertion with a statement that clears any stale `delayed_causes`. This correctly models the hardware's behavior of discarding obsolete interrupt events during a mode change and prevents the QEMU process from terminating. Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1863 Signed-off-by: Laurent Vivier --- hw/net/e1000e_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 24138587905b..d0ec892488d4 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -342,7 +342,7 @@ e1000e_intmgr_collect_delayed_causes(E1000ECore *core) uint32_t res; =20 if (msix_enabled(core->owner)) { - assert(core->delayed_causes =3D=3D 0); + core->delayed_causes =3D 0; return 0; } =20 --=20 2.49.0