From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a1213cccd9-27c143ca-9660-49ad-a44c-8e141f33f6f8-000000@eu-central-1.amazonses.com> Received: from AM0PR02CU008.outbound.protection.outlook.com (mail-westeuropeazon11023089.outbound.protection.outlook.com [52.101.72.89]) by lore.virtuozzo.com (Postfix) with ESMTPS id 9CA8D80726 for ; Fri, 9 Oct 2026 15:16:43 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RdVLpGseZ95D3a1BY4+HB2Wql4Ked0qXjobk3zpAf6crHzV9+4WNwJYb5VAh7ZkJlJy2SXXp/eBLb0CoEJoPEQi/0DMWRofUgIXSOMGlmBH3OOkqjuMKuElHb5LBZq2Y1+mLtDWpoOB1LJdFyxrKRYYh1hcF7pKOlQdgnenM3L1efp36cBM7r29PIuybCH/7oqU1ja3GVx1qicuCAVRy7/B7tDXZXJWUSruh5jAcfqmTYof3qX8XVdSabf//oAuWON8TkRDWbDFupYu6HcR+AU/mjVx6w1Minez6xvjdbczCnBxIDapOFTm2EmEw9QIO4AEEmHrOV60nJKvSAGLJdA== 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=1jTCrXBBTqKBokpbwNmS7TrOBg1wPx95f1ZOVMLcAzg=; b=SlpxpoBqZBsc0V/yGPVNvOqB38XdpuhYtq4nCKPlaps3l3OjJePXsVknSAvoC32BDMDS08/4CDHqAvuqcSZp1Hft5c/Q1Zq8UeJC3nwktS1YvUumUfKCBxRCfzInWGMCHsEPSysIciivcpS5lRl6k2JM08VHQ4N34TUo5LFk4oIni6cYth07NCGAg7Nkt2Ivre/8NLKQvqDf7Eq3F2yEHackQCg7SFhMbs1ZRYsmP+HP5n+k50aKDX2WDhq5pzsMYSpLm2vogBJMxm4wyZDlXHmmOeE/rHKRyvxwE6W3QPL8UrDZUhecZ1vZ82hk6Vpu7sC5aB9sMw67SGl+RmtBOA== 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=1jTCrXBBTqKBokpbwNmS7TrOBg1wPx95f1ZOVMLcAzg=; b=XfcLS1rbbCuCZG+TLjXFepBX116DhMhWR2HJnjWovbU0QJOHpvevl5rnYXSiaumuZ4iMSOpEGVA69wX67sGs5ZTWBV/a6kZ8FSQ6d/CRDGYMmAaVo+OKYX4BeaTPjHLdqkV+yYiikQBYdip9AvHIQ0xg756voeerW3pl2AF0lqk= Received: from PA7P264CA0050.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:34a::16) by DB5PR08MB10115.eurprd08.prod.outlook.com (2603:10a6:10:4a2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.522.6; Fri, 9 Oct 2026 15:16:36 +0000 Received: from MI3PEPF0000855F.eurprd05.prod.outlook.com (2603:10a6:102:34a:cafe::55) by PA7P264CA0050.outlook.office365.com (2603:10a6:102:34a::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.496.5 via Frontend Transport; Fri, 9 Oct 2026 15:16:35 +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 MI3PEPF0000855F.mail.protection.outlook.com (10.167.240.27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.522.6 via Frontend Transport; Fri, 9 Oct 2026 15:16:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1791558995; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=2HrUnhhkUw6SEeyALyDxOuc7UW1k5PPv3zZeAbrAnGg=; b=KNk0KowMjrzpf3F5D7VprICQeLqo6mvD9goY5HQBHgRqZakw12ZbuzzQgDIfBPrP AHxwDEKKnqDc6/9kO5BbyPwbasr2zNhgUS2pDYGSS+Zh8f0psdRpjoihbcfJMhubnYn QYLMh7KYekJ63GvxBJRBsBXjNXt1a+Zv15SeyqtvLL1OAHx/UBF7NxMVthXabrROyeL IZPQs26f74g0Gy90Ckbtk0m/adUp9a71g/DEwBef3O0pf4XOvvAGByGdjrPfSrqcsZ+ 4IGASBI2H0XG2Y3SRfJcUgMt/zVw6hE7rUzC1SEuPXZu4d/MuSuoNtrZDVFVuSiOHxZ DVqeOXfZ0w== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1791558995; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=2HrUnhhkUw6SEeyALyDxOuc7UW1k5PPv3zZeAbrAnGg=; b=kTPNwEEmBXis9Ut+wdhfGv46wLsUWf0xpOO0Af6qQnvfFaDsqu80OUoRqxbYS2xT 77QJSr0uMgOZ3pfI+26ZBUa6uFo7RcLJyVH9TV7I9VqlajN5F/7KPYvGx5bPKCOb/Wh j3MuK9sj3fQ7VHyo/xcCOiTYG8q59qX22tx5B/Tw= Message-ID: <010701a1213cccd9-27c143ca-9660-49ad-a44c-8e141f33f6f8-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 10/21] migration: yank: Move register instance earlier To: Andrey Drobyshev , svt-core@virtuozzo.com In-Reply-To: <20261009-vfio_v1-v1-10-2ae91d5b8048@virtuozzo.com> References: <20261009-vfio_v1-v1-0-2ae91d5b8048@virtuozzo.com> <20261009-vfio_v1-v1-10-2ae91d5b8048@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 9 Oct 2026 15:16:35 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.09-69.169.224.1 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MI3PEPF0000855F:EE_|DB5PR08MB10115:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 47ae5360-3d77-42d3-cb8a-08df26184f00 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|704162111799003|704161411799003|9140799003|376014|32142699015|61400799027|48200799018|56012099006|5063699009|4143699003|10067099003|18002099003|22082099003|55112099003|5113699003|4113699003|16102099003|3023799007|13003099007; X-Microsoft-Antispam-Message-Info: uCDLGQE2XvkzhBm/zuB56gWpZB3b82yoG+vrWrU40Ney4ZpktLtg8Vu+jnMTbXgvu8L1/K61JWVRO+d6w7HvPlk1XGBEg4pgPxHFKll689dwbO38fX8VikAFm/M98CPicvY0TOcX0lao8vU+MKAe2cYZmRIdeUEGZm+zJWrfXpgDB5LpZ7ceU9ce6FnQ09quyhXag51yHmD7I/9ljA7/scJmPLWkrbzgxEZmWsz6TZfs/bJNrTQA0ikfmIftgdLn3Oo1upziMqzztEeHxr72AmbLlZtdyIv7JAqP8PGU+2F5uRf8BoYFTpcjyjWkqiJ3Oy42h9NWwNGUzOwOazmKCOwXBH8efsJKFj3gTVwIKGQcaYDgdF/yn6L5jphoGDWevTyvrX5MPslqRwEIDIeV++yMKNY93ndlukbqMGtF2lIuXF7Me/+M4k+zXFPLKicinUn5RnKrEp9EetVEOtkytcUdLHUD15n+H5TmwMMpNrlOlS/KPkJNBwVdXS33FTkZVUBeEUDjYL9wdEV9bTRikS1LNWmI3mGPEfpx0w86ft2n3mCri54r7FT+sxTFqyjlhNZEG84pKBFII/PUkU8Cz9yBmTN5oyio71TDuCFWInUpdTYwWjlk6zoJy+h4xx5udCmtylbix7Hd7XfnwOI71ruEvPjFnuWfpOwyhW2znSMQfs4O1/hyMEURCPRI1F0sPdCNxYgMvD9EhiI9nY3U5SkBResjBXKlWA+vfFzfDnCeIBBBYUieTcS39xLKLr+VD8TuyN0XcTT7UkGr+3HPFwTBQdsImNmCQ/R6ovMTiOStKO1imP1lqMgJe0jypkoCeN1q2J1UNHH8sG89vNXf2eqBl2weibrCmFJJoIwziL0= 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)(704162111799003)(704161411799003)(9140799003)(376014)(32142699015)(61400799027)(48200799018)(56012099006)(5063699009)(4143699003)(10067099003)(18002099003)(22082099003)(55112099003)(5113699003)(4113699003)(16102099003)(3023799007)(13003099007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TpYBoOfa8eYtNdVCJ3eT2rmoM02oU8Eg3B9NQwxDGb7N5Sw5fmGkDKmDZiLvrIpgVSth793DH33Rd6va9k9KUO0pwLhIAl9oIv9Ieovp27fBd4gOX2LOiKu8cUtek973Irdl35rS0OWiUSPXBiNutb7K9prl+H3iqFxY0tH1Fpi+XuYdO+Q1YhzfETPmMAWbhnuoOcBvCXiVq73EpO8m0KPno12XDjOO5IDpIfq/erqe9ohhvGu/E18k8MeLawSlfy0KtWcc6X8RdF5DdLuRYPscqS86zGEhbSaPFeCT75N9mBmsWJvYiyOlUzR+t00/0INWN6A9E9NZ10eTDt5qKAoMCON3A6qmKznu+r0sX4/H3Y6hZsSrXY1p283Ct8yEJ5aIuKOGoWlIsFow0hNjvBnYO9rC0tsMjAcSHeG7AJWUx1ux48WNRdHh9SVkvjez X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2026 15:16:35.5737 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 47ae5360-3d77-42d3-cb8a-08df26184f00 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: MI3PEPF0000855F.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR08MB10115 Thank you for your contribution! Sashiko AI review found 2 potential issue(= s) to consider: - [High] migration: yank instance leaked when qmp_migrate_finish() fails sy= nchronously, aborting next migrate - [Medium] migration: unconditional yank_unregister_instance() in qmp_migra= te() out: path on resume -- commit 8b6d573d4b1ea369ae6968e2938e2e1b1c4366c3 Author: Fabiano Rosas migration: yank: Move register instance earlier This commit moves yank_register_instance() from qmp_migrate_finish() into migrate_prepare(), so that it can be paired with the unregister in migration_cleanup(). It also drops the resume_requested argument from qmp_migrate_finish() and adds a yank_unregister_instance() call to the local_err path at the end of qmp_migrate(). Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-11-farosas@sus= e.de > diff --git a/migration/migration.c b/migration/migration.c > --- a/migration/migration.c > +++ b/migration/migration.c [ ... ] > @@ -2235,11 +2235,12 @@ static bool migrate_prepare(MigrationState *s, bo= ol resume, Error **errp) > return false; > } > =20 > + yank_register_instance(MIGRATION_YANK_INSTANCE, &error_abort); > + > return true; > } [Severity: High] Can this call abort QEMU on a retry after a failed migrate command? If a previous attempt failed synchronously in qmp_migrate_finish(), the instance registered here is never unregistered (see the comments below). The state is then FAILED, so migration_is_running() is false and the next migrate passes the checks in migrate_prepare(). yank_register_instance() then finds the stale entry via yank_find_entry() and fails with "duplicate yank instance". Because &error_abort is passed, QEMU aborts. A privileged QMP client can reach this with an fd: URI naming a nonexistent fd name, an exec: command that cannot be spawned, or a file: target that cannot be opened, followed by any further migrate. [ ... ] > @@ -2354,28 +2353,22 @@ void qmp_migrate(const char *uri, bool has_channe= ls, > QAPI_CLONE(MigrationAddress, addr)); > =20 > } else { > - qmp_migrate_finish(addr, resume_requested, errp); > + qmp_migrate_finish(addr, errp); > } > =20 > out: > if (local_err) { > + yank_unregister_instance(MIGRATION_YANK_INSTANCE); > migration_connect_set_error(s, local_err); > error_propagate(errp, local_err); > } > } [Severity: High] Is this unregister reached when qmp_migrate_finish() fails? qmp_migrate_finish() is passed errp rather than &local_err, so only a cpr_state_save() failure sets local_err in qmp_migrate(). Failures from qmp_migrate_finish() never reach this yank_unregister_instance() call. [Severity: Medium] Separately, this unregister is not conditioned on this call having registered the instance. When resume is requested, migrate_prepare() takes the resume branch and returns true before yank_register_instance(). cpr_state_save() looks only at migrate_mode() and not at the resume flag. If mode is cpr-exec or cpr-transfer and cpr_state_save() fails (for example cpr_exec_output() failing), the out: block calls yank_unregister_instance() on the instance owned by the paused postcopy migration. Would the later migration_cleanup() then call yank_unregister_instance() again and hit assert(entry)? The old code guarded both register and unregister with !resume_requested. Should the unregister here be skipped for resume? > -static void qmp_migrate_finish(MigrationAddress *addr, bool resume_reque= sted, > - Error **errp) > +static void qmp_migrate_finish(MigrationAddress *addr, Error **errp) > { > MigrationState *s =3D migrate_get_current(); > Error *local_err =3D NULL; > =20 > - if (!resume_requested) { > - if (!yank_register_instance(MIGRATION_YANK_INSTANCE, errp)) { > - return; > - } > - } > - > if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { [ ... ] > if (local_err) { > - if (!resume_requested) { > - yank_unregister_instance(MIGRATION_YANK_INSTANCE); > - } > migration_connect_set_error(s, local_err); > error_propagate(errp, local_err); > return; [Severity: High] Does this error path now leak the yank instance? The removed yank_unregister_instance() was the only release on this path. migration_connect_set_error() only calls migrate_set_state() to FAILED and migrate_set_error(); it does not call migration_cleanup(). When the start function fails before any channel exists, for example fd_start_outgoing_migration() returning after monitor_get_fd() =3D=3D -1, neither migration_channel_connect() nor migration_connect() runs, so migration_cleanup() is never reached. Does the instance registered in migrate_prepare() then stay registered? The same applies to the cpr-transfer deferred path: qmp_migrate_finish_cb() qmp_migrate_finish(addr, NULL); cpr_state_close(); migrate_hup_delete(migrate_get_current()); No yank unregister is done there after a start failure either. The later patches in the series change the HUP watch handling and migration_cancel(), but do not change the yank handling in qmp_migrate_finish() or qmp_migrate_finish_cb(). The issue is therefore not fixed within the series. --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261009-vfio= _v1-v1-0-2ae91d5b8048@virtuozzo.com?part=3D10