From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11021089.outbound.protection.outlook.com [52.101.65.89]) by lore.virtuozzo.com (Postfix) with ESMTPS id 97DE380474 for ; Fri, 23 Oct 2026 17:11:27 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HeVIfulVmGdJuXQ+WVQxIe8mquTCK1crTOo8KrdKAdwDwW3ySiBCUYbOnJ5eiooStYnwp3EJxMedzk94SS0mkFG0f69o/5YUxNCNCMpwETNeDTIc3RNkueWoxCz9xiV8XhgUGmrBofMK43uUBkov4yeydhnrsa87y4DUCFJ/k57dzU+0HCTHctYdxoU0QHS1aiYmvezfc2M8APlG3WwD5PMig7udQvvjZWbfpZT8Eq3grmPBF4dC0Er9kXTlFKqVykL6v4fkxEX0ISzp64RU8R+0XgKrpnVnt29jrrpco9SwokAhWPGEoG7i+wCNiwV5J+QZUBQqA9gs1pBM45zAlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pK4XwAv+gQUIZyg6iflSVVkWfJMtK8VM7PBPpTLO7s4=; b=OMNcBA5HyDGK9c3a0gLZaBKwjlDemzoMFtoV2HMbfvido4qzoJnTStzA4X3+YOBdZDWA4RAXd7flAm+O+aaMKfOFj9XzAFooeYEfHk9Wj8YDFolgBvcdTBYKcOpSluZwiiT5B1Ox4aH9tK1cdsCSm20RsNml3XcKDB2/VFWJtNZhUTXday9HxsmPYYgk6+Kbl4bjSS4TFTzcSiRXInG2+M+xBGkKzwyuLHI90d1DUDVRnn05L508VjRagesIQNRMSS+g+sCxJslo12v72PnjE1MY6E9MKEMQrWlV7aWa0cGljGVIx3KOvem5IZHCxy8/EfnfqWjpP+wyFqU3z17jYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 69.169.224.5) smtp.rcpttodomain=virtuozzo.com smtp.mailfrom=eu-central-1.amazonses.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=sashiko.virtuozzo.com; dkim=pass (signature was verified) header.d=sashiko.virtuozzo.com; dkim=pass (signature was verified) header.d=amazonses.com; arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.onmicrosoft.com; s=selector2-virtuozzo-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pK4XwAv+gQUIZyg6iflSVVkWfJMtK8VM7PBPpTLO7s4=; b=JttexEW3kIGquL9NWcnzC08I+nERayzqYE2ag0ybO5LdvEml+o946q2eO/X3+U0IXZZELwWAdx5N1K9+YqnIA8VIQaypw1aoLqi7MNc549amv0TCUq5j3Cbvo5XvisOnGrE0pqFllgRr58R5Da7bbKS9vgtyJVoRYmHAuoVsCFw= Received: from DU7P189CA0016.EURP189.PROD.OUTLOOK.COM (2603:10a6:10:552::28) by GV2PR08MB672211.eurprd08.prod.outlook.com (2603:10a6:150:399::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.546.18; Fri, 23 Oct 2026 17:11:21 +0000 Received: from DU2PEPF00028D12.eurprd03.prod.outlook.com (2603:10a6:10:552:cafe::2) by DU7P189CA0016.outlook.office365.com (2603:10a6:10:552::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.546.19 via Frontend Transport; Fri, 23 Oct 2026 17:11:21 +0000 Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 69.169.224.5) smtp.mailfrom=eu-central-1.amazonses.com; dkim=pass (signature was verified) header.d=sashiko.virtuozzo.com;dkim=pass (signature was verified) header.d=amazonses.com;dmarc=pass action=none header.from=sashiko.virtuozzo.com; Received-SPF: Pass (protection.outlook.com: domain of eu-central-1.amazonses.com designates 69.169.224.5 as permitted sender) receiver=protection.outlook.com; client-ip=69.169.224.5; helo=b224-5.smtp-out.eu-central-1.amazonses.com; pr=C Received: from b224-5.smtp-out.eu-central-1.amazonses.com (69.169.224.5) by DU2PEPF00028D12.mail.protection.outlook.com (10.167.242.26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.546.15 via Frontend Transport; Fri, 23 Oct 2026 17:11:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1792775481; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=l8zbrFdsKnWeHpECbPZx6tJwklHwjci/8f9JZ+muXY4=; b=AUPLL6A3z/GdmvwHqDCPSkGRHfSYDz1YW2hKM/WaGenHRzSTwhOvZ0xGw75ah2lG 1y90gyFBGUplJpG/70m475snWLxgVUvhYMU5ovnUIYJKj3swiNC0uNYNNRhPeCvvQCz C36qDY7f1Wo2vjaACwNosO8kN40oDAA2IbgKMJLWfFYw6Wkn55tTfYQLv9TuZq7yoz5 7ozAxYu3o4DmO+KF8Gc+Z9ddauEoiFLThhMXrdmZeQ8RoITHP8crD5Y3FiZH1zuvcrE R64roZhzH3uOIPccviSxn/ja5AW6KpoAHOTUa7P/E/UQpZalHZ2nVAxs76vcCwKyknw +TjAdUDptQ== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1792775481; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=l8zbrFdsKnWeHpECbPZx6tJwklHwjci/8f9JZ+muXY4=; b=ZYnddbkwV7vuVomXvgz6oQ0wCTVmwVpS3ffrzb2T4cbJuwJuCtVPAeGCdI5KSuvH xxQtUddEG9g3hj0nA99CErO8ORbhGnjdwPY+wU+McpkDCPl5Gumr9aJiJHQiKLJg3wH U/vguFtdh+H32Dq4lP/rU7G04xDRM8wts0YWrlWA= Message-ID: <010701a169bee671-e9cf4a0c-ee7e-463f-8da3-f61537c5843a-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v5 17/36] migration: vmstate_save_state_v: fix double error_setg To: svt-core@virtuozzo.com, Andrey Drobyshev In-Reply-To: <20261023-vfio_v1-v5-17-ba0bf3c6d122@virtuozzo.com> References: <20261023-vfio_v1-v5-0-ba0bf3c6d122@virtuozzo.com> <20261023-vfio_v1-v5-17-ba0bf3c6d122@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 23 Oct 2026 17:11:20 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.23-69.169.224.5 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D12:EE_|GV2PR08MB672211:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: d0511ab9-2886-4da1-91b1-08df3128a91e X-LD-Processed: 0bc7f26d-0264-416e-a6fc-8352af79c58f,ExtAddr X-MS-Exchange-AtpMessageProperties: SA List-Id: svt-core@virtuozzo.com X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|48200799018|376014|61400799027|32142699015|9140799003|6133799003|55112099003|5113699003|4113699003|18002099003|22082099003|16102099003|261022105027099003|13003099007|5023799004|4143699003|261009223027099003|261021121427099003|10067099003|5063699009|56012099006; X-Microsoft-Antispam-Message-Info: YHZqCgFpWXgGt1ElmSKXs/tGgIIAxmGcWyiH6eoui3ku/zclyq7KKPqcqBI9iZl6lJZF+YNT3MQd1Djd4y3a4RgCsw0APwWK+y7YqF+moplCYYOYJ7YpN6tS+wlB0WWy7OSRCydJqe3QX74oeA0K1FgGTPmO962SilZiwvis9ce260bKpXtUmvoW3JGm5HIx+ykTKo1D/waS2DxuOuNHssXTx9Z+Zy14SCmiurLb4L/zl/EuZAR7G5zffGrvdMtt2Gf2L9/LQD0pdcFhX06Jv/eL5wq6+GJaeki+lBhhOHctZa063ZbJrcXxkojUDs2yaZDDolAeoTOZyrJ1vepbMRsXjGdWQHNchu25DMzshQyMoe4rfQgoAvgB7nOdw8r35Wz5VYTjt46Crjru0Uaa+UJQsMTIywB9ddaimkmGQlUf97E9/cZWEYz15+v0oygsuisB0leVTNJYP7addOm6DbZyn65oXx/3Lg5oRnFz4u3/RwIR4qyMaWHTGe0tRW3pSuqu2sOL5ETTvUnmoWdY1kPqJnM8ppDl+5jfvYNrmnywzC+JXTpcNzpJYQ7nFeZ4txrSoA/DHFwAVD6UXZ2N6MyxELxAuF8uRb7WO3dYqF1fgJlbm9iUby0sLsmPfEcygxo4tE/yCBkMdksx/K7eemvyhjW3TcBocucnLJdp5h93rMR+jyWRewhmQ3kzbUEXHQ8bKaNhCuZB759yPmrAfc/MWzZMMt1YIb/hE3eEw55RpSSNSuFtt6RjEATdhP4o/hlxbevQRTlwSKmeusY+3oqsi1fe9SogRdlNMwSN3rMwodVEl6GvSRZ0ZmXR6laEOFBbQ1lIdzVFkWAGoNIkDzjzdXJJJLxIMnh0k9bmbjxYUjDif1ZKcbKkOefDViOF X-Forefront-Antispam-Report: CIP:69.169.224.5;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:b224-5.smtp-out.eu-central-1.amazonses.com;PTR:b224-5.smtp-out.eu-central-1.amazonses.com;CAT:NONE;SFS:(13230040)(48200799018)(376014)(61400799027)(32142699015)(9140799003)(6133799003)(55112099003)(5113699003)(4113699003)(18002099003)(22082099003)(16102099003)(261022105027099003)(13003099007)(5023799004)(4143699003)(261009223027099003)(261021121427099003)(10067099003)(5063699009)(56012099006);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WnBnKejM5NdTB1bkT91i5N61dx4DZjP1/JHNGMxYl2MaMPcNMf5zBtBwanV8Rg37eHuJhX6G/IctUyAMUjVvK72zC9KJ675E5pIQf8WfTrmqjooMYWMDnVfs86Vf6YnNGuZ6nrRs0iHk3KhPP0+LTZuLQpsfaysS3/4R8P7eSIJ8RumGzYhQhNdA2rnHdmLEsRhkFO6U8nixupOK9E906GVZDzTC3S68hylS+hrmnYTvUNdmm4WZOHVZ/AQL3Ma8ecpXAliJXaVuChPg83O5Z6y+6JLOsI7zdSxUrgxzNsWPlpdQkUKmV6TF8SyCf5oKfz+3QvRBe6UaZLN3pHYben4PAFvrL/KXj3DWZYNydSsWwKpwhIADvy9ZAAxnQ5xozutsXd8MudIrv85lkplzhNO5nX3DbT7paH22Cpeu6bKecHulGOGE0w1MmRzMYBc2 X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-Auto-Response-Suppress: DR, OOF, AutoReply X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2026 17:11:21.4822 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d0511ab9-2886-4da1-91b1-08df3128a91e X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF00028D12.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB672211 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Medium] migration: vmstate_save_state_v() error_prepend() on unset errp = if put() returns >0 -- commit 02288718e44ad995a2dd7f4f453ddcf9d949e513 Author: Vladimir Sementsov-Ogievskiy migration: vmstate_save_state_v: fix double error_setg This commit avoids calling error_setg() twice on the same errp in vmstate_save_state_v(). It does this by setting the Error only when info->put() fails with a negative return, and by changing the later failure path to use error_prepend() instead of error_setg(). Link: https://lore.kernel.org/qemu-devel/20260304212303.667141-2-vsementsov= @yandex-team.ru > diff --git a/migration/vmstate.c b/migration/vmstate.c > index aea41c099463..04903131257b 100644 > --- a/migration/vmstate.c > +++ b/migration/vmstate.c [ ... ] > @@ -523,6 +523,9 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDe= scription *vmsd, > } else { > ret =3D inner_field->info->put(f, curr_elem, size, > inner_field, vmdesc_loo= p); > + if (ret < 0) { > + error_setg(errp, "put failed"); > + } > } > =20 > written_bytes =3D qemu_file_transferred(f) - old_offset; [ ... ] > @@ -535,8 +538,8 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDe= scription *vmsd, > } > =20 > if (ret) { > - error_setg(errp, "Save of field %s/%s failed", > - vmsd->name, field->name); > + error_prepend(errp, "Save of field %s/%s failed: ", > + vmsd->name, field->name); > if (vmsd->post_save) { > vmsd->post_save(opaque); > } [Severity: Medium] Can error_prepend() run here with *errp still unset? The Error is only set after put() when ret < 0, but this failure block runs for any non-zero ret. If info->put() returns a positive value, nothing sets *errp, and error_prepend() ends up in error_vprepend(), which checks only !errp before reading (*errp)->msg: util/error.c:error_vprepend() { ... if (!errp) { return; } ... g_string_append(newmsg, (*errp)->msg); } Before this patch, error_setg() ran for every non-zero ret, so a positive return was handled. A positive ret can also come from the nested path. put_tmp() in migration/vmstate-types.c calls vmstate_save_state() with a private local_err and returns the raw inner ret: ret =3D vmstate_save_state(f, vmsd, tmp, vmdesc, &local_err); if (ret) { error_report_err(local_err); } g_free(tmp); return ret; put_qtailq(), put_qlist() and put_gtree() follow the same pattern. If a pre_save or post_save hook in such a nested vmsd returns a positive value, vmstate_save_state_v() treats it as failure and the outer errp stays unset. Positive pre_save returns do exist in the tree, for example qxl_pre_save() in hw/display/qxl.c returns 1. That hook is only on a top-level vmsd today, where the pre-save failure path sets errp. I did not find an in-tree put() or nested vmsd that currently triggers this, so the problem looks latent. If errp were &error_warn, error_setg() would report and free the Error without storing it, and error_prepend() would then crash the same way. I found no caller that passes it. Would it be safer to set the Error for any non-zero ret from put(), for example with if (ret), or to only call error_prepend() when *errp is set? --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261023-vfio= _v1-v5-0-ba0bf3c6d122@virtuozzo.com?part=3D17