From nobody Tue Sep 9 03:17:51 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; arc=fail (Bad Signature); dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1745504882686982.300279635878; Thu, 24 Apr 2025 07:28:02 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id A1177B50; Thu, 24 Apr 2025 10:28:01 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 892B4CEB; Thu, 24 Apr 2025 10:27:13 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 75A44B15; Thu, 24 Apr 2025 10:26:45 -0400 (EDT) Received: from MRWPR03CU001.outbound.protection.outlook.com (mail-francesouthazon11011047.outbound.protection.outlook.com [40.107.130.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 474EEAE5 for ; Thu, 24 Apr 2025 10:26:44 -0400 (EDT) Received: from DU2PR04CA0162.eurprd04.prod.outlook.com (2603:10a6:10:2b0::17) by AM7PR10MB3796.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:17d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8655.35; Thu, 24 Apr 2025 14:26:40 +0000 Received: from DB1PEPF00050A00.eurprd03.prod.outlook.com (2603:10a6:10:2b0:cafe::52) by DU2PR04CA0162.outlook.office365.com (2603:10a6:10:2b0::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8655.37 via Frontend Transport; Thu, 24 Apr 2025 14:26:40 +0000 Received: from eu2.smtp.exclaimer.net (52.169.0.179) by DB1PEPF00050A00.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8655.12 via Frontend Transport; Thu, 24 Apr 2025 14:26:38 +0000 Received: from PA4PR04CU001.outbound.protection.outlook.com (40.93.76.79) by eu2.smtp.exclaimer.net (52.169.0.179) with Exclaimer Signature Manager ESMTP Proxy eu2.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_DIFFIEHELLMAN_WITH_AES256_NONE); Thu, 24 Apr 2025 14:26:39 +0000 Received: from VE1PR10MB3901.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:164::18) by DU0PR10MB6728.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:400::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8655.34; Thu, 24 Apr 2025 14:26:34 +0000 Received: from VE1PR10MB3901.EURPRD10.PROD.OUTLOOK.COM ([fe80::9be8:516d:147e:42e3]) by VE1PR10MB3901.EURPRD10.PROD.OUTLOOK.COM ([fe80::9be8:516d:147e:42e3%6]) with mapi id 15.20.8678.021; Thu, 24 Apr 2025 14:26:34 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, FORGED_SPF_HELO,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.4 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=kzAzNPKYgoedsH+eA9r+eLHeEELre57i2yguIz66sCE1wNgTpa0fR66bnuFgs6Gnw4j31+gnBemtNOM4m7h+rP4GNhkUnqCSRPI3BlM6+FfUC1qaT/aYiRXYArb0n6w9+XrZm54+z1vcP8Sb4OMInPdGZUF46svbTAZV4S+9tn8sBqWYPRQtTT44S1XP6V18V+wWRDyv1/3DIXI8OU8B8uKEqrlYXEpeHGgFB2FDvu2sHxBn/bazCDNyF105yR9Uj2UQZ6/5pJcixVeBMbIAyYVhmSA2SBbMeMuvkCNMSHDyhLVXtoatzN0kHkoubAPI/w42uD2DsZtsONg1Cxo8ig== ARC-Message-Signature: i=2; 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=IlzIYertM7pTYC2YfJZ9QKVH8k65b5Otq/I/ssLxmJI=; b=VJ7/uSoOsaI3Tlzu+mQ4mC+j1iAD342PZdqR8I9a85Zrr4WeInMLc2iq5L6Bv8QuwUcuD6Be8FfnvU5Z5J4kGkltwX4WchVc18jHgWczP7ECJGIQUtts0kZhCWFWXnJ4QTL1U1BpbkCQzLTbfYApERur3pMa0eA1fBV1xQFVBohYaMLekvn0nNhYKzKQIEV5aI1rPohcA5wsrgzBA6771tMhHr16ZZSHB8fvsXFFFFdknQgYyPibF2MKiLSb78aXvj1BcJVZkxtAmy8BLGDHD2PXjwkNYNxA/A3hPPuogLTN6V9lLsfzbWq0eMezN8XpLUj0ND1qFR3dakJHSaCCJg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 52.169.0.179) smtp.rcpttodomain=lists.libvirt.org smtp.mailfrom=stackit.cloud; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=stackit.cloud] dkim=[1,1,header.d=stackit.cloud] dmarc=[1,1,header.from=stackit.cloud]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IlzIYertM7pTYC2YfJZ9QKVH8k65b5Otq/I/ssLxmJI=; b=d+Wts5mHeoGey78P9M9LYoIufRPrxrZGh2+F9eIKd6wr9lR1dG4vDGDj0j0Ct4TW+3p4YFnGpslBTynJ3qhTo8TCbxPOdGHSvaUgP8O4SE2gbCw+X8fqOaARKsJUwuFGOQ/Fu4sGfI+jaD32QcpPcBp/O7kV9H5AP39B/vT/5cvnaw2CIPgyalKt9uppRs/fOWsAiGXpz+IkhK2hFuMZx9JCA/0hUPxbQgRtGaZhoa54yCFFJQLNwAxurnNVNFKsR6flIRFhHKehMLS7lUdrR41o9w6+F4rvdLLWTPOXi1aVy1KDK8cbqYPcIwztNM95R4YVPt1gp4EW7F4j0kZLJQ== X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 52.169.0.179) smtp.mailfrom=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud;dmarc=pass action=none header.from=stackit.cloud; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: Pass (protection.outlook.com: domain of stackit.cloud designates 52.169.0.179 as permitted sender) receiver=protection.outlook.com; client-ip=52.169.0.179; helo=eu2.smtp.exclaimer.net; pr=C X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 13557309 X-ExclaimerImprintLatency: 6883598 X-ExclaimerImprintAction: 27014ee0f737482db33f9af7eb9f5f69 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FPuQLTCpMU2ZpML7T8hx5SLd/SCIDWA/1r+nb+gmcwFLUifw6hCoT5GT+1nG3YHIqzUcCCe5ZHkdbLjEXQXS/E5CLW92JXsbPSR8u9lC/P9b4h6aSfAH/67T7s9PAXjt4PSKWmX8RFr8HQahdMmPEuWVsX347iJ9kW05nQxoc0Amxld0JvALh949jWjdlCg67kyjKdDV4iRxkR2A+2oTJFxMdPfsrTxit4TH9G23A4OBUxax+NGgt+SzRwhADJW2oU/ghQw8w+wXL0WLbKk8k+fGYnEc3qLty0+KGujqIMmzxnIAIEawqsW04Y7KbdJVrnYFm6rC+Hoy6ni2ztD4IA== 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=IlzIYertM7pTYC2YfJZ9QKVH8k65b5Otq/I/ssLxmJI=; b=HcYzd3wmZvzCGTzQOsmfXs2+/JsfdF9O7IzREFozy2Tk8cKZewMBEYEapb1bO8NsFGjHPsRBCaFInFnF8MgZkv0srbJrMG608vaT9D8vWQpot2ss9z/XNqlJtO0oeW9JZmXLZVUedK+Vp4HG9Y8I+MVhC73JBLABnn0shwfJ4umVoLlVXUv49G2W6aCfmYQEQxTH1tNVM+frzMdsq0mOHUltygIJCtdGqUbKBy0hIo1WA7/45gVa/LPEeRLXpoOcyYZdViHl/amxPKalMeQEQGgvG4v/xNaofHaoIAFUbqVOFlyNOYt1i8Hso+Kl8XebYfA7vY6n3ZSXe+Vcjq2KtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stackit.cloud; dmarc=pass action=none header.from=stackit.cloud; dkim=pass header.d=stackit.cloud; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IlzIYertM7pTYC2YfJZ9QKVH8k65b5Otq/I/ssLxmJI=; b=d+Wts5mHeoGey78P9M9LYoIufRPrxrZGh2+F9eIKd6wr9lR1dG4vDGDj0j0Ct4TW+3p4YFnGpslBTynJ3qhTo8TCbxPOdGHSvaUgP8O4SE2gbCw+X8fqOaARKsJUwuFGOQ/Fu4sGfI+jaD32QcpPcBp/O7kV9H5AP39B/vT/5cvnaw2CIPgyalKt9uppRs/fOWsAiGXpz+IkhK2hFuMZx9JCA/0hUPxbQgRtGaZhoa54yCFFJQLNwAxurnNVNFKsR6flIRFhHKehMLS7lUdrR41o9w6+F4rvdLLWTPOXi1aVy1KDK8cbqYPcIwztNM95R4YVPt1gp4EW7F4j0kZLJQ== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=stackit.cloud; Date: Thu, 24 Apr 2025 16:26:32 +0200 To: devel@lists.libvirt.org Subject: [PATCH v2] virhostcpu: Fix potential use of unallocated memory Message-ID: Content-Disposition: inline X-please-dont-add-a-signature: thanks X-ClientProxiedBy: FR4P281CA0257.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:e8::11) To VE1PR10MB3901.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:164::18) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VE1PR10MB3901:EE_|DU0PR10MB6728:EE_|DB1PEPF00050A00:EE_|AM7PR10MB3796:EE_ X-MS-Office365-Filtering-Correlation-Id: d557146d-7a9e-4cd6-f3bf-08dd833c06f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info-Original: =?us-ascii?Q?27nkrxdMXmlTg8MnJFje6qJDmPPBWAN9gjWVbcQegMGzjTXWQMs8dkeUAhLZ?= =?us-ascii?Q?u4U4hMZAJ/ISh99uKonzUz6fVZK2S/htUaqTOb4RPw2zGDREJ1lQYSVIjNRk?= =?us-ascii?Q?kDA3RfgbcUzvJstlp+rZiQuOa2tt+uoVNL5sYZEDi1b08k7qsWEub8ECU/KW?= =?us-ascii?Q?JibKRJkxZP6R470a32BYkk/P+98z4utVtYV7akNpxhQIqgwrRSWZB0uJKx9F?= =?us-ascii?Q?nSG5+sFDgcWfw1YjzdC+XJOZn5J0gmM6C1kEgsnzoeS+NY6wolWCcKYvLttV?= =?us-ascii?Q?AzMGuXLgfdxY8CtFbi17kniDpaPDnOnk7xTiv5JhQV+Ammrr/YOmkDdbIEKV?= =?us-ascii?Q?2nCaOvXXWihOTcwHuC7SWyUjAD/VA/MAGQADYbL/TUAz8CND5oOhwg3aBIjP?= =?us-ascii?Q?w10Owx7FCYWlMcUH3DdMv8Lisdwo07USzthH9JHb1OdYELsDP1OWrKsEVIMh?= =?us-ascii?Q?PyIpJgCWPV5p7hu4id9cYRqAHSc4u1rrysytk6AzyzDjAtOJ14HmIKXDaHIR?= =?us-ascii?Q?XCyHfLMOtWF1lVGcAmx7fsKYaXQ/aYa2gkBF3AvPSTflC3AvJ++Azk+E2yHQ?= =?us-ascii?Q?UVTGEqyUhoOxvp2RR+SxU3bycnE7/oLCYzI82JZF5GYDff2Aj5OuM7WIp/Hr?= =?us-ascii?Q?KTqWII26NZtd4iYrKlcUm4IqYMg2Yh887ekFoVDtK3wsARAPwRMnrt0zmxo3?= =?us-ascii?Q?Kmfp15xd4CIWbJg+HxweSetAXVe4jN3UpANPXmknxTRKS39l0p2qDeBtEbds?= =?us-ascii?Q?rxm3Rg9e2LHrS3rdobTVAbs73UA3VqSklS/B6VvAX71YV2SSrByFpinlHSKs?= =?us-ascii?Q?K3P7LUjvpLykCWM7NbA+KUyyB4D778c5Bay2twbDXu3jK7NtEUabVTmaBiei?= =?us-ascii?Q?AJfYCzEyAxEGzzz+QdjqTJg+nMYi40b/mHr7mvx4tipLFGveSKSOtZjzPcNQ?= =?us-ascii?Q?A8uCOMFA3K/tNyyMaP9n/7jqcPtZ638wzL+XzlrrQ1hIMDApZEPgWXytF84Z?= =?us-ascii?Q?GzCjWL1/CIWMsbuWgMc7HPySrVYrHPHmuqZbzjhjVnyEoZYOjw5ayfgzlO39?= =?us-ascii?Q?PUbayVvYAOdexN15maLyKjwBQOIRdEQ+AXSejiFCYw0r5NJrLDimmcepd69k?= =?us-ascii?Q?Ush8dmUj9peunnw2MQl1i07w/8OYCpFR3Ogdw+TxuF6bSHSpP7hk29EFWvak?= =?us-ascii?Q?EI9PR/LccPEovm9Chdzd2cxgPYwvQDjosZtaCEYN6KbeMSfTd0UdjILSjFWW?= =?us-ascii?Q?S+QZUhpezRw25+nYngE5Ei/NAzAj8Ruigbn2AzWCLzP3cU043zZUUOo3YfDl?= =?us-ascii?Q?ahkSTClRScKjQ3qC655DzNWRR1ZHxy/wxK3j9ovc1TPsBkm5yLHHncrr7+16?= =?us-ascii?Q?Yp3M58HboD0BVoDc1mHBUPoHf0S3acBuzoelJ2KkHgy+iS+sJgQmgMS0fYsP?= =?us-ascii?Q?muFwvHJbbWU=3D?= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR10MB3901.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR10MB6728 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF00050A00.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 639eac52-edbf-4df2-a23b-08dd833c03d6 X-Microsoft-Antispam: BCL:0;ARA:13230040|35042699022|1800799024|376014|36860700013|82310400026|14060799003; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6gBbPPm3oLh3vOdNTvUg2JYxHfqWPKCASy+M6WcWrAtx+IjA6XCZ8491/6vZ?= =?us-ascii?Q?N/XVly01QvNuqVa3Aus0Fq+04DGoiDQ9gfcCOq00KskJR/HP9Ur7UrJseusu?= =?us-ascii?Q?6KsylPcK2rHRSDZygUujncPXVElfgyTIdRUT87FhJIvMUdQsmrvpRIbGxBm9?= =?us-ascii?Q?4UlWx+Ru0Vn6hDjFnlYHFkBa8hqQ2jqzW6IaUTgJflYG6VTQVlH4kvT5/05s?= =?us-ascii?Q?OtF9YBS+1dQ3wwOATEjDTIIfd5uo2cTOWVoTrDae8OCgx70gUV41qS68mJCe?= =?us-ascii?Q?xVUqgwzZxyonQeNfhtMa+itVviyJeDO2+AYslSd1G0Zc77T8t8kRjSnX8191?= =?us-ascii?Q?6kWIytIdqyWScHk09ondFhMIwoMCHiR35335YkMtWNmyNpiNHwsxew748D8S?= =?us-ascii?Q?A28lj1u+0saCOh+yglMFGA225oN29OHdBk3M/1KiiEL5O4m6u9F9itw5A8HC?= =?us-ascii?Q?cWAVevec0glsW8S3KurQUawzgY89qcq3PdzdMuRP3OV85PjP3vBVA88V91JW?= =?us-ascii?Q?oCZnAH0J2Nc9eUFHUoBphq46H+dFT1SvPQk4hjd+oD8e+xUkTw5QklqP6NzF?= =?us-ascii?Q?/hShwDaePcZYmN5HHM1WU9L6QAh77zJQAbw/OUS3TJGlUT6xo907snXqEOaB?= =?us-ascii?Q?vzdXc430lGiPHx37D3xd0xt9IavzS4O4hqSIRkdFTKH8VECn381/03KIa7c1?= =?us-ascii?Q?GTbXC5Hhgro5N3q/vLvJJU/tKk0HM2NGc70UnQjdrsrBCF71YJ+YEHvY5MJd?= =?us-ascii?Q?17NESTWdYYMSK/ePJ5UviB5Vbi152NSGXysl/RyzwruBXjZOslOPoMLBfVU9?= =?us-ascii?Q?z+JJN7AZpZQY5ZvrUJTEkqbK6AQ/EQkaU+XFuUZwKTUvH07OKG6D+7ihXHCf?= =?us-ascii?Q?0QuHqPDikb31BNfkZKwNwHlOqA9SBjZ9vkpkUyqmrrB6oa7d1aI9KSsNQhsW?= =?us-ascii?Q?dlxn32I89geUP31UjOp4iuHgHpnXOstc6PCSFTRPgLr3yQKEOuHv9sjDK+jx?= =?us-ascii?Q?wtKHJywe+mD8n4bLHOdGFlHTzP7zOrpUYS7qYZn3ATNow34qnNCGzuz6HFC/?= =?us-ascii?Q?1FurL5WZSut7S/jgLjhmoXeW7d2oARNt/OJaycwvIA3n5pwBpKj2mDIwhwo8?= =?us-ascii?Q?5gDyYytnDV4z2izUSOH86tMFxpJ774O6XApf8rJPvzddNN8FQHfuSrL/aeZf?= =?us-ascii?Q?YT8MWagRgzwpYZ7UEwwweDNHkRRShOtiFZlofebO0yGPuToN4gRg+kAe3LZD?= =?us-ascii?Q?soA5q6r3dX/5utypqgomVFLwRvtG8IQXOAEjyz+YTD1mAlv9mQhYfOpfoC/J?= =?us-ascii?Q?i4RldNHMh/fOBz683zCZheiGhQ2XmGyq/hzaDOF2q0p79lPorjeoNl8Qlx2+?= =?us-ascii?Q?nek2qUVC+ajAJwVxWexln2IdO9Aktq0dV3mnRVMMS2Xg89b+Nb5H1mi8cyRF?= =?us-ascii?Q?kzFCHQQ/q0SNgj5NAYZiZgPmY2YKBeYEWIGkIjT+h9c0p8zbro7lYgbf6+JE?= =?us-ascii?Q?+rteQlHaXuZ8t9nPJOTc1giVGXSWnjMmiE/U?= X-Forefront-Antispam-Report: CIP:52.169.0.179;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:eu2.smtp.exclaimer.net;PTR:eu2.smtp.exclaimer.net;CAT:NONE;SFS:(13230040)(35042699022)(1800799024)(376014)(36860700013)(82310400026)(14060799003);DIR:OUT;SFP:1101; X-OriginatorOrg: stackit.cloud X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2025 14:26:38.6996 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d557146d-7a9e-4cd6-f3bf-08dd833c06f2 X-MS-Exchange-CrossTenant-Id: d04f4717-5a6e-4b98-b3f9-6918e0385f4c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d04f4717-5a6e-4b98-b3f9-6918e0385f4c;Ip=[52.169.0.179];Helo=[eu2.smtp.exclaimer.net] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF00050A00.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR10MB3796 X-MailFrom: Felix.Huettner@stackit.cloud X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 Message-ID-Hash: IISF7HPAPYK7HJG4DG47VUJ42XU3ANQJ X-Message-ID-Hash: IISF7HPAPYK7HJG4DG47VUJ42XU3ANQJ X-Mailman-Approved-At: Thu, 24 Apr 2025 14:27:09 -0400 X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Felix Huettner via Devel Reply-To: Felix Huettner X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1745504884928019100 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In case of a host that has a large number of cpus offline the count of host cpus and the last bit set in the virHostCPUGetOnlineBitmap might diverge significantly. This can e.g. be the case when disabling smt via /sys/devices/system/cpu/smt/control. On the host this looks like: ``` $ cat /sys/devices/system/cpu/present 0-255 $ cat /sys/devices/system/cpu/online 0-127 ``` However in this case virBitmapToData previously only allocated 16 bytes for the output bitmap. This is becase the last set bit is on the 15th byte. Users of virHostCPUGetMap however rely on the "cpumap" containing enough space for all existing cpus (so they would expect 32 bytes in this case). E.g. cmdNodeCpuMap relies on this for its output. It will then actually read 32 bytes from the start of the "cpumap" address where in this case the last 16 of these bytes are uninitialized. This manifests itself in flapping outputs of "virsh nodecpumap --pretty" li= ke: ``` $ virsh nodecpumap --pretty CPUs present: 256 CPUs online: 128 CPU map: 0-127,192,194,202 $ virsh nodecpumap --pretty CPUs present: 256 CPUs online: 128 CPU map: 0-127,192,194,197 $ virsh nodecpumap --pretty CPUs present: 256 CPUs online: 128 CPU map: 0-127,192,194,196-197 ``` This in turn potentially causes users of this data to report wrong cpu counts. Note that this only seems to happen with at least 256 physical cpus where at least 128 are offline. We fix this by preallocating the expected bitmap size. Signed-off-by: Felix Huettner --- src/util/virhostcpu.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 5dbcc8987c..4805484b1d 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -1090,28 +1090,26 @@ virHostCPUGetMap(unsigned char **cpumap, unsigned int flags) { g_autoptr(virBitmap) cpus =3D NULL; - int ret =3D -1; - int dummy; + int ncpus =3D virHostCPUGetCount(); =20 virCheckFlags(0, -1); =20 if (!cpumap && !online) - return virHostCPUGetCount(); + return ncpus; =20 if (!(cpus =3D virHostCPUGetOnlineBitmap())) - goto cleanup; + return -1; + + if (cpumap) { + int len =3D (ncpus + CHAR_BIT) / CHAR_BIT; + *cpumap =3D g_new0(unsigned char, len); + virBitmapToDataBuf(cpus, *cpumap, len); + } =20 - if (cpumap) - virBitmapToData(cpus, cpumap, &dummy); if (online) *online =3D virBitmapCountBits(cpus); =20 - ret =3D virHostCPUGetCount(); - - cleanup: - if (ret < 0 && cpumap) - VIR_FREE(*cpumap); - return ret; + return ncpus; } =20 =20 base-commit: c5a73f75bc6cae4f466d0a6344d5b3277ac9c2f4 --=20 2.43.0