From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 2452B802D3 for ; Wed, 17 Nov 2021 10:41:53 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0CAD020A79 for ; Wed, 17 Nov 2021 10:41:23 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 8224420A6E for ; Wed, 17 Nov 2021 10:41:22 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5BDC243D36 for ; Wed, 17 Nov 2021 10:41:22 +0100 (CET) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pve-devel@lists.proxmox.com Date: Wed, 17 Nov 2021 10:41:17 +0100 Message-Id: <20211117094117.1872784-1-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.259 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu] fix #3728: handle machine without type X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Nov 2021 09:41:53 -0000 libguestfs starts their helper VMs with `-machine accel=..` without a machine type, and our pve version suffix handling would segfault in that case. there might be other scripted use cases that are affected as well. this regression was introduced with the rebase of our patch set on top of 6.1.0 Fixes: f376b2b9e2fc1f0c8f9c6275e96ede5f423c4126 Signed-off-by: Fabian Grünbichler --- ...E-Allow-version-code-in-machine-type.patch | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/debian/patches/pve/0024-PVE-Allow-version-code-in-machine-type.patch b/debian/patches/pve/0024-PVE-Allow-version-code-in-machine-type.patch index c54a5f8..0eb9682 100644 --- a/debian/patches/pve/0024-PVE-Allow-version-code-in-machine-type.patch +++ b/debian/patches/pve/0024-PVE-Allow-version-code-in-machine-type.patch @@ -93,7 +93,7 @@ index d87cf6e103..e5010236f3 100644 g_slist_free(machines); if (local_err) { error_append_hint(&local_err, "Use -machine help to list supported machines\n"); -@@ -3312,12 +3318,29 @@ void qemu_init(int argc, char **argv, char **envp) +@@ -3312,12 +3318,31 @@ void qemu_init(int argc, char **argv, char **envp) case QEMU_OPTION_machine: { bool help; @@ -109,15 +109,17 @@ index d87cf6e103..e5010236f3 100644 + + // PVE version is specified with '+' as seperator, e.g. pc-i440fx+pvever + name = qdict_get_try_str(machine_opts_dict, "type"); -+ name_len = strlen(name); -+ pvever_index = strcspn(name, "+"); -+ if (pvever_index < name_len) { -+ name_clean = g_strndup(name, pvever_index); -+ pvever = g_strndup(name + pvever_index + 1, name_len - pvever_index - 1); -+ qdict_put_str(machine_opts_dict, "pvever", pvever); -+ qdict_put_str(machine_opts_dict, "type", name_clean); -+ g_free(name_clean); -+ g_free(pvever); ++ if (name != NULL) { ++ name_len = strlen(name); ++ pvever_index = strcspn(name, "+"); ++ if (pvever_index < name_len) { ++ name_clean = g_strndup(name, pvever_index); ++ pvever = g_strndup(name + pvever_index + 1, name_len - pvever_index - 1); ++ qdict_put_str(machine_opts_dict, "pvever", pvever); ++ qdict_put_str(machine_opts_dict, "type", name_clean); ++ g_free(name_clean); ++ g_free(pvever); ++ } + } + break; -- 2.30.2