From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11020081.outbound.protection.outlook.com [52.101.69.81]) by lore.virtuozzo.com (Postfix) with ESMTPS id 7669F8017D for ; Fri, 30 Oct 2026 14:59:59 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TsyX6oNVQKaSqM6Ri1WncFHipEyEyaeclX3Tkln7TdkeJSfX0fl7Hjwe6LYvQDwTFEwcRREEAnBn0NVoULEIwPfbzgxYGYrInrOl5Wlah9RIj+raCMFBBk57Pv9rco1Bnc3NKTC0eJzkkPHsMpClxBjsCBvCyX4HsPz8f+6mNkGFQY3+EN9n+bRZ2KdqosFXKSInwPE5juAxEsH/RnLRkb4R/+AeCbWJiJvMaIJPsDMCJKcpLMZYfMMEN2hO7G3YjbS0cuZBWthXGX1Ezw+88Sq0kROYSkgaztRRefnO8dZ7viC4ywTuYMWK86LwfrYgt+wtiNyBPKMu/nJvEVJCTw== 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=EGn9jTP5SWcLP/Vzl13qwoZorfW9wQJua6iKg7c2AAM=; b=OL62jeHVBD8vSFAb2AhbqzjkzqjrVFiVSuiQiEWwjHPgWMb1OFjB7H3Pbevfx87IprYWvJlsvAcTxS9ntSW8mcQQ3nnCbRd3iIEBS5o+cVdOboWUZw84o1TOL8MbfLEQgMUJVZokbt7e6ed/br50MsKEfXnadaElq8w8VK3ew9RFmRGC1P6r14upd9As7ID+DVoR0HzB9ldrH/847AVAFhNwuXKhMD/BJEwzGPkfCA6y2vFSHVKuePCz6WktG3B2jY0pQ1u8JeHsuGMVnJvWzuQ1+MUHLwiS0Hlj8MxYAS85h77B/3z1eVjCkxPgtj8M5XykTZJK5cwnykHDsBqKUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 69.169.224.1) 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=EGn9jTP5SWcLP/Vzl13qwoZorfW9wQJua6iKg7c2AAM=; b=baXoUA/acRp6vn2KN06NenKlm33GZhJ/EKKaFZpQ8AR7T+olIQ/WXvVd/0YtNX9aZedHeuRfuzUrE5+5yrpUx6vRrYvnd270AXVSEQOscyMIkTGdA4qj3x7kjrShTHFy6P9vEP8fBEjy8AZa7aDAZ6pwplaZsclG1wP3FNj0X4M= Received: from VI1PR04CA0126.eurprd04.prod.outlook.com (2603:10a6:803:f0::24) by GVXPR08MB10986.eurprd08.prod.outlook.com (2603:10a6:150:1fc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.569.9; Fri, 30 Oct 2026 14:59:54 +0000 Received: from ZR1PEPF0000E6B7.eurprd07.prod.outlook.com (2603:10a6:803:f0:cafe::57) by VI1PR04CA0126.outlook.office365.com (2603:10a6:803:f0::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.569.9 via Frontend Transport; Fri, 30 Oct 2026 14:59:54 +0000 Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 69.169.224.1) 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.1 as permitted sender) receiver=protection.outlook.com; client-ip=69.169.224.1; helo=b224-1.smtp-out.eu-central-1.amazonses.com; pr=C Received: from b224-1.smtp-out.eu-central-1.amazonses.com (69.169.224.1) by ZR1PEPF0000E6B7.mail.protection.outlook.com (10.167.241.70) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.592.5 via Frontend Transport; Fri, 30 Oct 2026 14:59:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1793372394; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=hyiUSEJee2/hS+dBXc2ZDc3yNsrwg6NmruuJLkrl9X8=; b=d/Ca3GNri+03c9jVa7F2BtTSdXfmkp22x/OPlNMq5x12wc+fm6rQf/g4LKu6Z5Yw 14aAsrpV1AmC4cYJlHUZ8NmqpWMv+wJ34XUrwsj5lQHb2FuKkUvN6yo6/lSgUbEkliH JSwZie5o6l6lWKQzpPXfmWTn84T+wrUeGwcAJ1lxxceM0yLgjlK7uahVZZIUlfO0RfA IsdNoHZUYrxyNjgX/+NVpyTYjIJQweAReNvYV6K6vPsyqQr4wOFW4sB6/4fhsQXI1is 5Y3PlqlhKwbbUSsJZQ3SXnUMQWhJqsXWOI7Tlyvl+SYGptgp4P1Nh+mmGKaTt6T6doI BOSG8+PRbQ== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1793372394; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=hyiUSEJee2/hS+dBXc2ZDc3yNsrwg6NmruuJLkrl9X8=; b=fvjdd1tiOtq7w4AIPaGK26QGnAcNahbAiynuBCGtpHGYFi7nsNX5QsJkyyIBN+JT xjMIOCd4T9LIxCdAgHpQS9Ljo3QGvH7AN9f9Nlx0I1axob3RXLn+7QKhP3G5eaOsWCu MYgNMNYIlzCifj5ecMMkQBO9cdV0p/QvqF51XEpc= Message-ID: <010701a18d5311e6-df675ece-d524-4f76-9e03-f3fb48373239-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v6 17/34] migration: vmstate_save_state_v: fix double error_setg To: Andrey Drobyshev , svt-core@virtuozzo.com Cc: andrey.drobyshev@virtuozzo.com In-Reply-To: <20261030-vfio_v1-v6-17-45de246bc92e@virtuozzo.com> References: <20261030-vfio_v1-v6-0-45de246bc92e@virtuozzo.com> <20261030-vfio_v1-v6-17-45de246bc92e@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 30 Oct 2026 14:59:53 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.30-69.169.224.1 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: ZR1PEPF0000E6B7:EE_|GVXPR08MB10986:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 14afa88b-c51f-4c0a-52fb-08df369674e6 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|376014|48200799018|61400799027|9140799003|32142699015|5023799004|4143699003|5063699009|56012099006|261009223027099003|261026121527099003|261028144727099003|261026140227099003|261021121427099003|261022105027099003|10067099003|55112099003|16102099003|18002099003|22082099003|5113699003|4113699003|13003099007; X-Microsoft-Antispam-Message-Info: uxdiBSozTum7g56m7UBRVKbHRQnKTI+Chi/FvskeM1SVd/2jlqA7AuF+CdKCZTcHBh7SWmdO24JqwCmLHi91m5A8/h2qaIGamTqqGzhwGtLwhAukagSt9pmj5utSLvZmhIjklU0emNmM4QJfx5Ovi0hhaHcvJx0vVJzizEsyTzYW+iD/qOawWCK5ZtmeqxyDcmT/ZqIn3X9XHhZ6vgTMho2kQCaIIxHDUHrWkd9jyr612EzQoHFGFoCWZJpl1OFY/4GJM9yTnwBkcEHle88z3CFoW+T/Z68bDXGpbrUzgrvXPLViA1F41+cXRAa5E5BoPLskZpeyLGsl/+u84lK5IlWZ10UhfbZnhYndkCfIqNMEo73qf64/G4/H+Ei9CKJGXvjTLfgJEMieuFUh1v99U6631/ZG+ApedXVXiASjCTCKIWCGlqskZOfIrBbKgNYTCTKl+s0n2/kQV3NN/CGVFmtNikIJBqHZOdsIZ+Bqi2SVNIFXzYyhj0rIUNmiIJBoKLj7iv/T8Zdwqj3ABrAqq3iQfz4IHx2vyQggpiwpPuTHWJ3vYDPZYrOdjruNfUO3/80Wjc1/bVgUQ3T+3+i0rw2p4e0Cwrdq3lCrrcM1x3FLicdcSyvjMEBUOYPboucU68rbbUtNZBpnQM4fqriqAeQajP1UWVLiwXmeaG0CcTJgLGz9GdZDvUAOIbDwVpkwNs0DC+gLo/akckHo7aG7YkFI3eZjct/Lq0X4KMcufG8NtJ3GEcY24YwhMENfSk4rpO3d6zyz9Ykj5UPQ1niq3WzNnt8nd2xq/D9plLv8mJrN0/8DmqOpCCk8KAC2zGKXt5UPtXGHAobd7eAkPnLsbSCW+/iGORj98EnZ+B4aL9zgWwoWBkOMdJOAF4IudTYZ X-Forefront-Antispam-Report: CIP:69.169.224.1;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:b224-1.smtp-out.eu-central-1.amazonses.com;PTR:b224-1.smtp-out.eu-central-1.amazonses.com;CAT:NONE;SFS:(13230040)(704161411799003)(376014)(48200799018)(61400799027)(9140799003)(32142699015)(5023799004)(4143699003)(5063699009)(56012099006)(261009223027099003)(261026121527099003)(261028144727099003)(261026140227099003)(261021121427099003)(261022105027099003)(10067099003)(55112099003)(16102099003)(18002099003)(22082099003)(5113699003)(4113699003)(13003099007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pLEYY009jhxoLJZ4wuMJag58Mgds1hEukedqHF6/pDXp/PgFk/Y2U+sf4W+VGM6NlEvcbLR5JvRNyat5w8rXZ4cJEKEA4kW+JS5bLka/aiV+5t8mPop/yGY1bKhJ6CEcbjWT/mzeIsj5fTTx0xPCxCJt6BNfwkLOQ42+rgpowC3Xt1aRXtYdqK1WIjLqVn2kuaeXyBlDev6Jq8P7XiwWcdMYa7fA4CMl6EAL/TiP5uCxQS32TUDFAx7LLCPCxmOCDhmZe8RCp1OjrrUu2Gr9JFbHal7qMTWfdnoxs3QSspjqsqhZY7YEG7eb1sBzy08S9NE/Q95e8QPqlc21I8ASYBY2d3xkPVYHB9xZHqJY84h519LkuLqJKSdc0VTEr6P5BPPKH14nTp+UeTztP/U07tsXMHSOK/9prAJk//PiV1RlN/HQFdDQQsVe1aXHLWY5 X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-Auto-Response-Suppress: DR, OOF, AutoReply X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2026 14:59:54.3441 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 14afa88b-c51f-4c0a-52fb-08df369674e6 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: ZR1PEPF0000E6B7.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB10986 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Medium] migration: vmstate_save_state_v() skips error_setg() for positiv= e put() returns, then error_prepend() crashes -- commit 9a80393fe491fbf7dc54d43181d6301bb98018c6 Author: Vladimir Sementsov-Ogievskiy migration: vmstate_save_state_v: fix double error_setg This patch avoids calling error_setg() twice on the same errp when a nested vmstate_save_state_v() or vmstate_save_state() fails. It sets the Error only for leaf put() failures and uses error_prepend() in the common failure branch. 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 positive return from put() leave *errp unset here? The new error_setg() runs only when ret < 0, but the failure branch below runs for any non-zero ret. The old code called error_setg() for every non-zero ret. Nothing in the VMStateInfo.put contract restricts the return value to zero or a negative value. There is an in-tree put() callback that returns a positive value. put_power() in target/arm/machine.c returns 1 when cpu->power_state is neither PSCI_ON nor PSCI_OFF: if (cpu->power_state =3D=3D PSCI_ON || cpu->power_state =3D=3D PSCI_OFF) { ... return 0; } else { return 1; } > @@ -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); With ret > 0 from put() and a non-NULL errp whose *errp is NULL, this error_prepend() call reaches error_vprepend() in util/error.c. That function only checks for errp =3D=3D NULL, then does: g_string_append(newmsg, (*errp)->msg); Can this dereference a NULL *errp and abort QEMU on the migration or savevm save path, for example when a save races with an ARM PSCI power-state transition? Callers such as put_tmp() and virtio_save() pass a real Error **. Would it be better to use "if (ret)" instead of "if (ret < 0)" for the leaf put() error_setg(), so that *errp is set for every non-zero return? I found no later patch in the series that changes this. The upstream commit d41ce10d0f5a has the same check. > if (vmsd->post_save) { > vmsd->post_save(opaque); > } --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261030-vfio= _v1-v6-0-45de246bc92e@virtuozzo.com?part=3D17