From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a14562801c-56f821a2-280e-40c5-9163-8a44e2f3bd99-000000@eu-central-1.amazonses.com> Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11020081.outbound.protection.outlook.com [52.101.84.81]) by lore.virtuozzo.com (Postfix) with ESMTPS id 2D227802A5 for ; Fri, 16 Oct 2026 15:44:26 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CLBQRVBqMt1AXQnw9uzRKdDcj3lRbtD37XlQuwoez26MAC61pVKzjT2d2hvBo+BPlzpy8iTnvLtG5ckO93yHg+DWdKc94z22fw76yEmHKfX15ZNMKFCnvqUbV9qGtWr0CZbsk3ZZB887FTiY1DodpdpKeumsTZ3IM4+GIci0jZQcKy5cc9InSYbtBNHnx0jSzhBfM0kuH1UrqutILGvYSBTSfiAgb4ttFmU360yR5qpQPkh8LCkLC3GgMtLN6RiWiY44jlM47kfgzg7H91Hz2Hi9x3whqGe6NHJuFn9HYPxzPD30o2XOq2LCYOh8FlbNuqVf8lgWLcUG0CGGMft2cQ== 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=nBXMMuB6wLXA1NNpsg0r4Mv10e6uNTzJW6Rvjk+zBsA=; b=hv4afkm0sKruUgutr+SewLWjaqTGCZqV9KrOVX57s7kqeyk8T4Ich0AjuSLbdOkDbIwZc2TvCdfXOg8croLlfMLUC9F+76D9uB5QO+cytN2aGdkKbb2OoGDOrBgUcCbVpcCbLEGY1eBNym228HRrPdRV07au/XSeIrgX30wYe6lQb81Zolq51DHb7Hjs0y96/VcKUjpN71Xlt6SsStCMlH+W6bEe8OaEHyukVsnT/Vx2svM0tKczySSHDzSGKJWW2McFpsYYFgNP2mQGipTB448++hIgl8D2hKCnRyBajmHdfF70keKWeNbJSJW4CmNQzehOG1EjTf42A8fhKPssXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 69.169.224.2) 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=nBXMMuB6wLXA1NNpsg0r4Mv10e6uNTzJW6Rvjk+zBsA=; b=dSZAnqQlx3TIy9c9vYzwnJiNrEN1mLIKsxL77BGRsuAc8VI3aQrixOM11iiebvbxqWaMC/7ec+F5vgPr4uSAC5L1rDKEMomQ1SV2f/n9LtXFaq6VaHMj3e3ylY1kclpP0EvdPumkNRY2SqU16yU9Y2jbTZ1+Qh5WJZuKPkBl4AI= Received: from DB9PR02CA0027.eurprd02.prod.outlook.com (2603:10a6:10:1d9::32) by PAXPR08MB6415.eurprd08.prod.outlook.com (2603:10a6:102:12f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.546.11; Fri, 16 Oct 2026 15:44:06 +0000 Received: from DU6PEPF0000A7E4.eurprd02.prod.outlook.com (2603:10a6:10:1d9:cafe::a2) by DB9PR02CA0027.outlook.office365.com (2603:10a6:10:1d9::32) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.522.4 via Frontend Transport; Fri, 16 Oct 2026 15:44:06 +0000 Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 69.169.224.2) 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.2 as permitted sender) receiver=protection.outlook.com; client-ip=69.169.224.2; helo=b224-2.smtp-out.eu-central-1.amazonses.com; pr=C Received: from b224-2.smtp-out.eu-central-1.amazonses.com (69.169.224.2) by DU6PEPF0000A7E4.mail.protection.outlook.com (10.167.8.43) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.522.6 via Frontend Transport; Fri, 16 Oct 2026 15:44:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1792165445; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=F0j5zt7C2rzQ/vuSRKHDLI2xOcIl47mgBNtexDvQIXA=; b=AVY8VXE4oJhL/ir7L/ikQZbpX/YWHMDKK1fSnOD1ap1ovv20V2N9YwJ9yRd7x63I QvdfZD5/fZlscKIh1DSfUguNTCTSllmHq5zpeV0LMQEF0RhcE83gxD3M4ZQpHUVdMsr UloUN3SkyZxdylhSrMsTNjlNqoyOTAheZpXK3Bpk/I3AFAaWIkry2t9AlSaxe4qrZOY Q26PQHoCTxTZN4nupVra2q+a7qqsAnQoWWN5j36yfZdrjNTPKnKWs4RFCSCNJx4RA4L 77jUKRRYkf3AsuORYUnBuNTtsIl8rl3LTxY6jfk9zWa5UsEksETBN183/khWrZfx/6V x0qG4q8Ydw== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1792165445; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=F0j5zt7C2rzQ/vuSRKHDLI2xOcIl47mgBNtexDvQIXA=; b=aBll8jP1zmzaO5zbieLTa8YLBzHFkYxz/x++FdE7nlHIGgTB7y7MWnQiKkdx3pvC RSPEaNVbF2NsrJf5YsH8laBDloHH4MMa3SXE0N3e+ah7hSrYLp8jLqZS/KAXnZIBcKX EmKrCfvoRD/rXNKxb43bbOx5H+7vPu7bzY1FSuuk= Message-ID: <010701a14562801c-56f821a2-280e-40c5-9163-8a44e2f3bd99-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v3 17/28] migration: Fix crash on second migration when cancel early To: svt-core@virtuozzo.com, Andrey Drobyshev Cc: andrey.drobyshev@virtuozzo.com In-Reply-To: <20261016-vfio_v1-v3-17-47487cb5a8e5@virtuozzo.com> References: <20261016-vfio_v1-v3-0-47487cb5a8e5@virtuozzo.com> <20261016-vfio_v1-v3-17-47487cb5a8e5@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 16 Oct 2026 15:44:05 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.16-69.169.224.2 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU6PEPF0000A7E4:EE_|PAXPR08MB6415:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: bbc8a2df-f861-4622-227f-08df2b9c4fc6 X-LD-Processed: 0bc7f26d-0264-416e-a6fc-8352af79c58f,ExtAddr X-MS-Exchange-AtpMessageProperties: SA List-Id: svt-core@virtuozzo.com X-MS-Exchange-Transport-Rules-Loop: 1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|48200799018|376014|9140799003|32142699015|61400799027|56012099006|5063699009|4143699003|261009223027099003|10067099003|22082099003|16102099003|18002099003|55112099003|5113699003|4113699003|6133799003|10063799003|13003099007|3023799007; X-Microsoft-Antispam-Message-Info: cFsUxTeMY4mL397OFieZoisFKCPsZoiX3twSDAFosrNXKqXDAjPKb7hOoNM3S3M68vpA52ulNZBK34F7IKhqzRAEuSc2SKmnoaxHItu5GAYPbXAPmhO0XS10sfMvtfQpAA8OKZrHHSyQhl2Wd/n4jXE/VPOubB2xZxIwo2EHy5dmpeAsOars1dZIdrShL20ztXxomREQSoI58lGACObl899d1X9ULY7+dULjxXol9GzHjD+PGgBiCtkQmG9fcwmqafPyI6VEnMaAnPvp1lAAOLSiXK/0Yil6oRf8sF1bQBEUCOvKmyMT+CWXzDLKp8zqOcu4wsSXM/Js7BD12lwm5Oxw+ryGedvRB9cXXBJDRGURn6phvV2nqDpLWfrYwHoPfC1wuAKpS+4bS0bRA+SW1/+GBKzrxTjvoFgSPupAlkjBlcpJd8q1MB2Wrxz1ysfeuhgf1wNdHfi2qert5fiJqm9ORGpCdZFYKkz6h2dm8U7r2aGMR7x2zmKiBlUByskEfS3tuQZJaThD3kTRlI4e+vhVaDI2FcnCiyvUuyrMWLOPW/oBRIgLiBUtgn2r6u68XTzOgf5UxXIjrISEhXCsBRjJspylpCnwJA+L0Hbf2z0b88+UGFr6L50stOLqoghRpxhv+e7MSJ6WCcreO0nCKjjOQQrn7ajIsLEsZ5LOFSu/cSdwlNGxt8C2slIpWv1WUqrQWcoQnFhTuor19US1tUX52hUbehqZON6vXinfMHOyLrarIhMi7vZsSPUkP9KskFxUsCjgIdAUv2R8a+D/ywiQFwEvSHCn1IGZhFJdubvUzr5aovkJlaKST58mLCoFBwZHuCsy/J9WiSjDMxdZBjM40Q0qIYhUNrph18JGAsY= X-Forefront-Antispam-Report: CIP:69.169.224.2;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:b224-2.smtp-out.eu-central-1.amazonses.com;PTR:b224-2.smtp-out.eu-central-1.amazonses.com;CAT:NONE;SFS:(13230040)(48200799018)(376014)(9140799003)(32142699015)(61400799027)(56012099006)(5063699009)(4143699003)(261009223027099003)(10067099003)(22082099003)(16102099003)(18002099003)(55112099003)(5113699003)(4113699003)(6133799003)(10063799003)(13003099007)(3023799007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uTZeE3tPpT7MvUhKlttx52j1MrrnTjg0rdXuOrmTKJIwjUzFcHAJGwPJ+eadNx8ixX9g4JQlElPdQbaWewGNnQFTUL9PcAVC8L3XsjMzlE23zHuDG1R3RRLCCEN8Nu19kYdSeHxsqL9VqmuOUXITRP+qlNvnkv/t2k8XdsOTn8SZLTpCHhBKDt/xfaiuCI6dbTRc7dzem+249wJfillCA3BnIhpSdztr7imLSmBYl2iod4lb3z7wg0ygmG1f/CBQTp7pBQECkScoBE9kHpI/3fMoVSqoXSi0sA317aVVbFsFn9BOMatbveuMcm2Lky+N+gRTL9gZZ8mfVl5dqZg2xz5oYnos4UXfUPD4vrbJIjlVO7idaGfnb2J7Lkfs0EJJdQqd1TO8BCrWQela1Kl0xeRpmZ5roUhqbMxD1m5elJoDGJxoeh/lbiut8wl7YVmi X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2026 15:44:06.2297 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bbc8a2df-f861-4622-227f-08df2b9c4fc6 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: DU6PEPF0000A7E4.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6415 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Medium] migration: migration_cancel() asserts on mode that migrate-set-p= arameters can change -- commit 1a45829d1f41fe592f4ff72499c683f6dac53858 Author: Peter Xu migration: Fix crash on second migration when cancel early This commit changes migration_cancel() to call migration_cleanup() when the cpr-transfer HUP gsource is still pending. The goal is to avoid a crash on a second migration after an early cancel. It also clears hup_source as soon as the HUP callback runs, and adds assertions. Link: https://lore.kernel.org/r/20260417184742.293061-1-marcandre.lureau@re= dhat.com Link: https://lore.kernel.org/r/20260421175820.302795-1-peterx@redhat.com > diff --git a/migration/migration.c b/migration/migration.c > --- a/migration/migration.c > +++ b/migration/migration.c [ ... ] > @@ -1653,14 +1653,19 @@ void migration_cancel(void) > } > =20 > /* > - * If qmp_migrate_finish has not been called, then there is no path = that > - * will complete the cancellation. Do it now. > + * This is cpr-transfer specific processing. > + * > + * If this is true, it means cpr-transfer migration is waiting for t= he > + * destination to send HUP event on CPR channel to continue the next > + * phase. If so, do the cleanup proactively to avoid get stuck in > + * CANCELLING state. > */ > - if (setup && !s->to_dst_file) { > - migrate_set_state(&s->state, MIGRATION_STATUS_CANCELLING, > - MIGRATION_STATUS_CANCELLED); > - cpr_state_close(); > - cpr_transfer_source_destroy(s); > + if (cpr_transfer_source_active(s)) { > + assert(migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER); [Severity: Medium] Can this assert abort QEMU? migrate_mode() on the source falls back to s->parameters.mode, because cpr_get_incoming_mode() returns MIG_MODE_NONE there. That value can be changed while hup_source is still set. The sequence would be: qmp_migrate() with mode=3Dcpr-transfer -> cpr_transfer_add_hup_watch() (state stays SETUP, hup_source set until the destination closes the CPR channel) qmp_migrate_set_parameters() with mode=3Dnormal -> migrate_params_check() -> migrate_params_apply() migrate_cancel, or migration_shutdown() at QEMU exit -> migration_cancel() -> cpr_transfer_source_active(s) is true -> assert(migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) fails As far as I can tell, neither migrate_params_check() nor the apply step rejects a mode change while a migration is running or while hup_source is set. The migration_is_running() check in options.c is in the capabilities path, not the parameters path. The wait for the destination to close the CPR channel has no upper bound, so this window can stay open for a long time. Before this patch, the cancel path in this window did not assert on the mode. Would it make sense to reject a mode change while a migration is running, or to drop the mode assertion here? > + assert(setup && !s->to_dst_file); > + migration_cleanup(s); > + /* Now all things should have been released */ > + assert(!cpr_transfer_source_active(s)); > } > } [ ... ] --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261016-vfio= _v1-v3-0-47487cb5a8e5@virtuozzo.com?part=3D17