From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11022084.outbound.protection.outlook.com [52.101.66.84]) by lore.virtuozzo.com (Postfix) with ESMTPS id 5A9D680478 for ; Fri, 2 Oct 2026 16:54:23 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L76eEvMCpoMaCDsboh8onli8F1xoL2nb+cK2LWq7MFB6yPPivPVZfb7nz6s7ys0zQmManxtiLVM2ghf1KRlaaz7KjklcsfQAA6BYzEFn13jgb/f8ZiYX5oVWK+iCq5N/rw9TtzHrDYLYYi0RLEs4YIMABT7ZK7U+Vrv/6skLeWJjXKtYZ7lYrM2NsUbMe73uV5QEIQRcHS8Yy7YsQowaI64PTBtA7ZA0BKQmjEgqfhPkAg+5Id6Bd+KxKvBy7ghd3pUYcOAJcpJuLFlwYQLKmJvW8Y/7/peHnrRkk2a9Y4Wm3FopgoueFmGvkfqwd/XutWM+5ItVWupCOjHczvnwsQ== 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=oiGdBcLAubWMU73kRR1P2ke8CPpKNKEtxZd9hLw49ko=; b=YEArCZ06I4n+sHLcmnLb3ZcL+tU8NUtzQzf+sy9NxdD56mUcdGSiRxPb5BL4qMjXWHqSCAFODCE1bcdzV0662bFcwSFAG5Mc1uHx1nCjJGQE+kwwaK9BDesqwOttNPSQ97w1Ks+jM0T0pRh0P05jpvFNt1fDC/F9GdB+IJfIVM3W5JaeTIQGR70+evBBMl5jG0p7JuIPKdVFAZu2ivtkQgO03MMCSa4ZBcqN47D5rtuTl+cZfs6uGqvlNy3v3nBuo+TCawwYWNIZYYQPhtcWwt+M8sYmn7AU7Fg32dPFJkBPEMyzXmcRw6PrrgRDm5UxeZiSzBqQ1uinebO+vlQAJg== 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=oiGdBcLAubWMU73kRR1P2ke8CPpKNKEtxZd9hLw49ko=; b=bBRKO6D3jAeW+oylBPbYwpmCAd49aQdDAT8kwmx+2ILkcMih754WODcE7a1XxxHbmT/6sJUJRsI/6UcbVoQduPo6esWdxBNzYdw9pEyty0iJH866qTnQGdOesq0Ofhi10IGcCCIqtofZIWYiezRDVbMOgjtykfPdbglHGkiQELM= Received: from AS4P191CA0022.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::13) by DU0PR08MB8836.eurprd08.prod.outlook.com (2603:10a6:10:47d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.472.18; Fri, 2 Oct 2026 16:54:15 +0000 Received: from AMS1EPF00000098.eurprd02.prod.outlook.com (2603:10a6:20b:5d9:cafe::26) by AS4P191CA0022.outlook.office365.com (2603:10a6:20b:5d9::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.472.19 via Frontend Transport; Fri, 2 Oct 2026 16:54:15 +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 AMS1EPF00000098.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.472.14 via Frontend Transport; Fri, 2 Oct 2026 16:54:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1790960054; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Message-ID; bh=8SyNNwgAopQkHB28zKpNwIErblOcCOOWSmGDpCPEtK8=; b=c8zbRfsbZBIu0vEabkQm6tqD87nnCu2wkls+cActb2HVxP/8Q+e0xYqznav0GCKF XOFAj7WASU4k5WkOYEcWShfrFqa+iD7N59ulMIwC3LtZ79J6owJoUXKF8vQZwulyOFM SvXYkmgtHBBFiIBdUlxP5Sp3UZ8TuuBb1PEbfXEWT83AlC/SOAHPhhpNAUgmXc9xtlr IBHCi6lZqSvjni7WX3/sfVTPxkFi7R84g038tTc6IHtpW9fQlBfQnJZInlcyfDvPf91 fql+2HrzJCu6IIceO/602DS+VXOuLTa0bS2I8dvhZTETUh93ktlN6LbSY87ONIm1JJq FhyIlmk8Cg== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=sokbgaaqhfgd6qjht2wmdajpuuanpimv; d=amazonses.com; t=1790960054; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Message-ID:Feedback-ID; bh=8SyNNwgAopQkHB28zKpNwIErblOcCOOWSmGDpCPEtK8=; b=ZSWjViAYPI8Cb6oibHiulGocz+TbtHIFjL3PZxWJ3mjyQyLc9RLskpHqArE06RC+ /O3k57RKqB+bCPuJ8bTFcUoOBhjvb1tnhAuVFnESzg40NRuNcCEhI9J/txQnkYoYWYp jkes6fGds/ivgRoknkI635ysviUZJKNlqJ8d3AO0= From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH 2/3] chardev: preserve the logfile fd across cpr-exec #VSTOR-148304 To: svt-core@virtuozzo.com, "Denis V. Lunev" Cc: andrey.drobyshev@virtuozzo.com, den@virtuozzo.com In-Reply-To: <20261002164853.2130337-3-den@openvz.org> References: <20261002164853.2130337-1-den@openvz.org> <20261002164853.2130337-3-den@openvz.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 2 Oct 2026 16:54:14 +0000 Message-ID: <010701a0fd89af0e-4b97c9ee-579e-4483-8907-0df1ee410fda-000000@eu-central-1.amazonses.com> Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.02-69.169.224.2 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS1EPF00000098:EE_|DU0PR08MB8836:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: e667e0d6-ed69-4040-01d1-08df20a5ca49 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|704162111799003|32142699015|376014|61400799027|48200799018|9140799003|5063699009|56012099006|10067099003|13003099007|5113699003|4113699003|4143699003|18002099003|55112099003|22082099003|16102099003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2c0UjkzaGdjdURhNXB2ZitWbndYa3EwYk5Nc3hxZFR5cWxNdDJW?= =?utf-8?B?VXVwOVIvMHZYWTVVWStUcE1lYTRYSnlhMnB2dFQyYUk3d3NRdjJYU0xrL2Ix?= =?utf-8?B?cTFDUVFoNGNENWN0UUdjSFJyT3NIb3NmREl3djFsREJjT2hSK0lrQWhIeko1?= =?utf-8?B?WndTTVBPczUzMWZ3dHRUQVhvR2dvU2w5OGpNaER6d1pOMkpYOWl0bDMyZjdU?= =?utf-8?B?ZEZaT2hVQjFYeWRaZ1hQVzUzQWszZEFtOHVIRlBTbWVuYjNLQ014QWhYeVE4?= =?utf-8?B?M044UElsZEpEYXl1ZmRCVXhWWUVUTzdjVE5YTk80OTljb2g1RWZPc0s5WDhF?= =?utf-8?B?VlZoTU1yL3JnOXBXZzNNQ0JKTDN4ejBoWmp5L2VKdVB4bnpTQ2VBa0ZNeGMy?= =?utf-8?B?RHJUQmN3ejlqM2dEWWJxdUtMNVVGK1J4NEd5THE0MlV2ZVU0UT09?= 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)(704162111799003)(32142699015)(376014)(61400799027)(48200799018)(9140799003)(5063699009)(56012099006)(10067099003)(13003099007)(5113699003)(4113699003)(4143699003)(18002099003)(55112099003)(22082099003)(16102099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Sv7g7CbTVQY0rbY5qG9WTNASm6KerNooipKvetVLXQHYUmhjAooT+Av62oqAeR+3NCMUJE4/XyHZkobmR1Sxm75qq3TzE4gH84sjHKW/Z8ZuTOwvNZPwwF2K9UxJj/ncCz+Gb2/eKrhhF/qmx0XXKX6HJJQVMO04ZgfGqwEYWx2ms9SzxWKvFT2iFq/BHGV7coZv4F1HAOTdpJm2PF6uD/3EvbICGFyCYyr3YsMXVnTMMNtswnWIl+HzLqHZV3sgP28N+IlXfl7oqmo3noseKN6TpQ6wA27hnmXDvkLywS9iVSuL0GuudnWZ5fm3kAplS6fDn4pUqEDp5ZfZKkrPyYPiZ2vXSNqe76RHVKjO9/as4YVDJZuLzb14ygFvEcSAKqiJ7L0cSXbw8/blaK+EoyQ7oTMXdtrJLlTEynhXLgyAk+cOyYe34KHlwSSjxnFo X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-Auto-Response-Suppress: DR, OOF, AutoReply X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2026 16:54:14.4722 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e667e0d6-ed69-4040-01d1-08df20a5ca49 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: AMS1EPF00000098.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8836 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Low] chardev: logfd saved in all CPR modes but claimed only on cpr-exec = incoming -- commit 05df918f015920ae0431d59bdf9bb6ff8741e4fc Author: Denis V. Lunev chardev: preserve the logfile fd across cpr-exec #VSTOR-148304 This patch saves the chardev log fd in the cpr fd registry under the charde= v label. On cpr-exec incoming, it takes the fd from the registry instead of= reopening the logfile path. If the source did not save the fd, the chardev= runs without a log. > diff --git a/chardev/char.c b/chardev/char.c > --- a/chardev/char.c > +++ b/chardev/char.c [ ... ] > @@ -261,9 +262,21 @@ static void qemu_char_open(Chardev *chr, ChardevBack= end *backend, > } else { > flags |=3D O_TRUNC; > } > - chr->logfd =3D qemu_create(common->logfile, flags, 0666, errp); > - if (chr->logfd < 0) { > - return; > + if (cpr_exec_is_incoming()) { > + chr->logfd =3D cpr_find_fd(chr->label, CPR_CHARDEV_LOG_ID); > + if (chr->logfd < 0) { > + warn_report("chardev '%s': log file was not preserved, " > + "continuing without it", chr->label); > + } > + } else { > + chr->logfd =3D qemu_create(common->logfile, flags, 0666, err= p); > + if (chr->logfd < 0) { > + return; > + } > + if (!cpr_is_incoming()) { > + cpr_delete_fd(chr->label, CPR_CHARDEV_LOG_ID); > + cpr_save_fd(chr->label, CPR_CHARDEV_LOG_ID, chr->logfd); > + } > } > } [Severity: Low] Is the log fd handled consistently across cpr modes here? The fd is saved to the registry for every start where cpr_is_incoming() is false, but it is only claimed when cpr_exec_is_incoming() is true. In cpr-transfer, the target takes the else branch in qemu_char_open(): chr->logfd =3D qemu_create(common->logfile, flags, 0666, errp); so it reopens the logfile path itself. The save is then skipped because cpr_is_incoming() is true. Can this leave the transferred fd unclaimed in the registry, and also hit the same permission and virtlogd-bypass problem the commit message describes for cpr-exec? This follows the exec-only pattern in char-file.c and char-pty.c. I did not verify whether cpr-transfer sends every registry fd. If it does not, the leak does not occur, but the path reopen remains. [ ... ] > @@ -315,11 +332,14 @@ static void char_finalize(Object *obj) > if (chr->be) { > chr->be->chr =3D NULL; > } > - g_free(chr->filename); > - g_free(chr->label); > if (chr->logfd !=3D -1) { > + if (cpr_find_fd(chr->label, CPR_CHARDEV_LOG_ID) =3D=3D chr->logf= d) { > + cpr_delete_fd(chr->label, CPR_CHARDEV_LOG_ID); > + } > close(chr->logfd); > } > + g_free(chr->filename); > + g_free(chr->label); > qemu_mutex_destroy(&chr->chr_write_lock); > } [Severity: Low] In the cpr-transfer target, can the registry entry outlive the chardev here? cpr_find_fd() in char_finalize() returns the transferred fd, which differs from chr->logfd, so cpr_delete_fd() is not called. Would the stale registry entry and its open fd then stay until process exit? --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/2026100216485= 3.2130337-1-den@openvz.org?part=3D2