From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11022126.outbound.protection.outlook.com [52.101.66.126]) by lore.virtuozzo.com (Postfix) with ESMTPS id BD1A08045D for ; Tue, 20 Oct 2026 16:45:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bYW0kzGZuBn+5vidBBqtEstZjBWSjfqkc3MK15xvW9Hr8gKCkFcmthZEl+lU+rLQ2xjXJ72fv7Lvx9B3u2NmTxxZr8A8oQRLO4G5hYUkzziJhVDGVLpCEdCCnuezuajB5+/r+MMK+KkN1HsEQWQa1q4WnKA0gVXGXXptGsrPBYmruv0o1tpwtuwZpQp97LrBDdblERmeQsERlF9k4xTvBNLoJrZ2BUTBe36PrhGqRIGVztLfKa6f+SqL5oUcxQQHNKZ91BEVyvsj2qBhq5GFVvwG+Bxc7GBlrT/ffY133tA1i0F1GHZf5ccxX8tOwwivY1plljioqlDwwXH47TQOVA== 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=mafgYsV7F9VM4eOlrHCob2rd/3gmZZWIMHTbcMgW/Jg=; b=EztgJHm7Uc31YGva0cX5FHraJDgKhzjr08QUBEWhYYI7tUgUJYLabJY8r5DL+ANFyCQCB4x4Um/D8Z+SQ8L34tN6djARXwB7KHjogbSjAqPKzrk6hWdimtbaTGSq5JVA8UM+2oS7mDHGLtqmBs9W4F+LoVuk5HNi8Nqhp7FvlpAEkfnI4i0TWpU2EvELeclMorgueQUrkOxcMEaFb0Y466LvhpOnNfQLok3wMlbkLnhOLvE6+0iovpC6wBQUG0jQm0lb+c8sC0OfI2VRpcGvtiLu6U31HRZBVTkDbKUExtf80hjEA+GVcR2QEUSG2r8iyCQtVdfuyjxOw1BoGBWtSQ== 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=mafgYsV7F9VM4eOlrHCob2rd/3gmZZWIMHTbcMgW/Jg=; b=G0go7vxs3lIupwABDy3PjOFKjxSZIGFF4eKLSpGJeYOuFPPkbg5ArcDsnwSGuHkwZ9qCWM/0Td8I4QZ6a2/Xj7m8TEHuyUfKH3M1E9KBpXW6PXF7Zw4HEXV3AAaMSBFc58DaGOpYXJE8Ta+wWxNFvZE64fM66Oy1FWkJHEierxQ= Received: from MA2P292CA0019.ESPP292.PROD.OUTLOOK.COM (2603:10a6:250::17) by AS8PR08MB8040.eurprd08.prod.outlook.com (2603:10a6:20b:54a::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.546.14; Tue, 20 Oct 2026 16:45:49 +0000 Received: from MAD0EPF000008B5.eurprd04.prod.outlook.com (2603:10a6:250:0:cafe::15) by MA2P292CA0019.outlook.office365.com (2603:10a6:250::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.522.20 via Frontend Transport; Tue, 20 Oct 2026 16:45:48 +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 MAD0EPF000008B5.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.546.15 via Frontend Transport; Tue, 20 Oct 2026 16:45:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1792514748; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=bcaHbG0kVsxuOT8CHFc0xdNbgNhg53AXEhmKfAziTSE=; b=r9ZFZFsMIEgotjCzT92DIIwILs0dv//kqjVcDALUuM7+FsLwxvKa1WO4Q1RJyqks C9yqYJLBJnLyYstPDHdH1usAiFauIT4WcDs+LzG2yZY9kDZXEFs6c3yILkvO64mmXnk Ha0JjMJ7MVeFVhINU4y7R7a7XPz+PfqvKuRB9hNjmQ1xdQP8mXXNH5FWWvqJW62tCRq g+nxq278Z53eV0Fi8NL8waXmxzzju9orOcbWSmdptQMPhTCLk7NPx3oVv1rSwV8yb+n fKla5MLNIXrGLD7qt6+hQjkEdJIesPkM49n3jGcizCsYds0+AX7ToYT4a9VrvXLVFGe 7/0p6Wi2cA== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1792514748; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=bcaHbG0kVsxuOT8CHFc0xdNbgNhg53AXEhmKfAziTSE=; b=A8BaV/WFvEDO+IcP34kBJZ63WUuPCYUJr8J74JIQgGXliCNvdmwQrRiJBqlFHwXJ Ke+UEEmLhIWjBMwiOzlyyDIAf8oIQHki7CI6OIko3trnCpChpVrIA8AbQ90DEwop+VH gRbu2UhsAHECNCl2hTtM+zrxgOdkGtVmlsaYyo4s= Message-ID: <010701a15a346efb-3f958ffb-3a18-4aef-9140-d19c6edfeb4e-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v4 15/31] migration: vmstate_save_state_v: fix double error_setg To: svt-core@virtuozzo.com, Andrey Drobyshev In-Reply-To: <20261020-vfio_v1-v4-15-83a5668230e5@virtuozzo.com> References: <20261020-vfio_v1-v4-0-83a5668230e5@virtuozzo.com> <20261020-vfio_v1-v4-15-83a5668230e5@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 20 Oct 2026 16:45:48 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.20-69.169.224.5 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MAD0EPF000008B5:EE_|AS8PR08MB8040:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 216d2571-f789-466a-e446-08df2ec99840 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|704161411799003|9140799003|48200799018|61400799027|376014|32142699015|56012099006|5063699009|4143699003|261009223027099003|10067099003|18002099003|22082099003|55112099003|4113699003|5113699003|16102099003|13003099007; X-Microsoft-Antispam-Message-Info: R3SgWi16Yn+jQX4w3Rlxjxbl+02J9MCH33XC4dOOGmTGM8OzEVmWlCLfpNYFPX31m2zL3TN39ugXOP8/bwxVT78BksUxAbYr9nSgnmgMrhofavhCsLVP8gJMKqhYYE0ua29gHaWPuBdfo2INIt/AOq7fg96cY5+Bti/zp/rQZPTwvQMPJbUJvaVf04gcDbG5w6DeWFe5Pz4E+/hm8lS+wdD7TUNVJZKLojOBIyaKSEPxYxDhDnUF0KiaM42S5FNK6yFppTnMy5NLs26gpOdtyiLvDgHjQfVBKqyfdL9LfKQ0l5dNnl8cYjGX9CT6GYOoa0PiooZGL6hyngI/OVG+8q8Ocbk3rF/xCNIWbuy/BgVeRlIGT3gmd9ppRMkUTBqjQHOckpX9PQFkr0lw10A5vprPUNNbrDuVZtupczY4XWzyZm7aD65oR61zYu5zJL1E/OT5dTYYClmeOZMleL8rylv0a0kptb4boAFmjbDdCCBFcruSEh4rTBSjNo8PM7C72rpMRCTI9JSEzFZcwnLTaNhYkbCxqqNwg1uiH/VzSUlvpDpcyV9kyqfm0PomM6vjWl/mXk4yrANW8daWIM4J5Vq/voigPhbIAPy+QQ+acQPdLJO4pV87UxA/SMi+mKMjo18Ygt9+lcrtmN0ukv3QJ6QGLIqztufjf1mWOjNl1GWjedyt1THEn3t2BPM2971qRevnP0nFCEEcJ3YWqTNnY/z9VHFSn//M9Z38zam/0qydPN4Qz6FJJaxB5wMzFjN06vvIzSkZkB5h5VqLHZ+jSqD4+ssGHCLzRhMeYHzgAkaJGDLdgiTbOloTzxp3KMIEpi8UxTtQQAunps1K4hlnVNQVHp21b7fY/+X269Oxrfs= 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)(704161411799003)(9140799003)(48200799018)(61400799027)(376014)(32142699015)(56012099006)(5063699009)(4143699003)(261009223027099003)(10067099003)(18002099003)(22082099003)(55112099003)(4113699003)(5113699003)(16102099003)(13003099007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QC0IWwNtJXF2GkCokiTaky+bReb+WUzIqPf0YKsHJLxDQAuG8kMVQ9BnrHwAHapoldsvYRNqP4YbQETJF0RWbio7QLKhdJdvdOqjLwJlRZH0fYlMHLq8QIfa4wUnW+AE0TkN4QsthpvPjjlWQmuPFOLI+RQjE8Bx+nCv86UAcSwc3efEsoXyvCmCAeXW+psMHPeRrRu9irJ5iOXo7yDdz0cLz0F871rRft3zewV0ODlxZFSVQyYjjd/XjpvfFkgnSfT0mfqJPgY+AaCcSmx0oqq2ope73LB6o3RYnezCyW46CQA411vyfyGGf7nzKwnwKSYNYIsiQk7zMV3hdcIt2lCtxA9gaNWV6Dcuq4HSLGNnXi/j7s04+ewtLX3ZSaL89oboNA+edRAs/r5Zs2XcxgxgdxX3uLC/d7X300eFiqqZCpWlQRQDqe/4XmT0mCDi X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-Auto-Response-Suppress: DR, OOF, AutoReply X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2026 16:45:48.6692 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 216d2571-f789-466a-e446-08df2ec99840 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: MAD0EPF000008B5.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8040 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Medium] migration: vmstate_save_state_v() prepends to unset errp when pu= t() returns positive -- commit 900cd58df40307b6407d20cc283e62cccfe53256 Author: Vladimir Sementsov-Ogievskiy migration: vmstate_save_state_v: fix double error_setg This change avoids calling error_setg() twice on the same errp in vmstate_save_state_v() when a nested vmstate_save_state() or vmstate_save_state_v() call fails. It sets the error only in the leaf put() branch, and the outer failure path now uses 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 > --- 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"); > + } > } [Severity: Medium] Can a put() callback return a positive value here? The new error_setg() is guarded by ret < 0, but the check further down in vmstate_save_state_v() is if (ret), so any non-zero return is treated as failure. target/arm/machine.c:put_power() is an in-tree example. It returns 1 without setting an Error when cpu->power_state is neither PSCI_ON nor PSCI_OFF: } else { return 1; } In that case ret > 0, errp is left unset, and the code continues into the failure path below. > =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); Can this error_prepend() dereference a NULL *errp? error_vprepend() only returns early when errp itself is NULL: if (!errp) { return; } ... g_string_append(newmsg, (*errp)->msg); If the caller passed a non-NULL errp, for example the one passed from savevm.c, and put() returned a positive value, then *errp is still NULL and (*errp)->msg is a NULL dereference. The old code called error_setg() here, = so this case did not crash before the patch. The same thing can happen at each nesting level, since a positive ret propagates up from the VMS_STRUCT and VMS_VSTRUCT branches with no Error se= t. Would it be better to use if (ret) rather than if (ret < 0) around the error_setg() after put()? Alternatively, the outer path could call error_setg() when *errp is not yet set. > if (vmsd->post_save) { > vmsd->post_save(opaque); > } --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261020-vfio= _v1-v4-0-83a5668230e5@virtuozzo.com?part=3D15