From nobody Sat Apr 11 23:08:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772548966641280.40656528600937; Tue, 3 Mar 2026 06:42:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxQvb-0002rb-EQ; Tue, 03 Mar 2026 09:40:51 -0500 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 1vxQvW-0002jk-NH; Tue, 03 Mar 2026 09:40:47 -0500 Received: from proxmox-new.maurer-it.com ([94.136.29.106]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxQvU-0002VR-5n; Tue, 03 Mar 2026 09:40:45 -0500 Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id D7CD648842; Tue, 03 Mar 2026 15:40:28 +0100 (CET) From: Fiona Ebner To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, zhao1.liu@intel.com, wangxinxin.wang@huawei.com, qemu-stable@nongnu.org Subject: [PATCH] target/i386: only migrate error code if actually set Date: Tue, 3 Mar 2026 15:39:55 +0100 Message-ID: <20260303144024.366764-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1772548803706 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=94.136.29.106; envelope-from=f.ebner@proxmox.com; helo=proxmox-new.maurer-it.com X-Spam_score_int: 26 X-Spam_score: 2.6 X-Spam_bar: ++ X-Spam_report: (2.6 / 5.0 requ) BAYES_00=-1.9, HEXHASH_WORD=2.999, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.322, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.141, SPF_HELO_NONE=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: qemu development 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-ZM-MESSAGEID: 1772548972833154100 Content-Type: text/plain; charset="utf-8" If cpu->env.has_error_code is true, backwards migration of a VM from a QEMU binary with commit 27535e9cca to a QEMU binary without commit 27535e9cca will fail: > kvm: error while loading state for instance 0x0 of device 'cpu' This happens even if error_code =3D=3D 0. Fix it by only sending the error code if it is actually set. Cc: qemu-stable@nongnu.org Fixes: 27535e9cca ("target/i386: Add support for save/load of exception err= or code") Signed-off-by: Fiona Ebner --- target/i386/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/machine.c b/target/i386/machine.c index c913961281..b47b14d819 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -466,7 +466,7 @@ static bool cpu_errcode_needed(void *opaque) { X86CPU *cpu =3D opaque; =20 - return cpu->env.has_error_code !=3D 0; + return cpu->env.has_error_code !=3D 0 && cpu->env.error_code !=3D 0; } =20 static const VMStateDescription vmstate_error_code =3D { --=20 2.47.3