public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu] fix #3728: handle machine without type
@ 2021-11-17  9:41 Fabian Grünbichler
  2021-11-17 10:38 ` Dominik Csapak
  2021-11-17 16:20 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Fabian Grünbichler @ 2021-11-17  9:41 UTC (permalink / raw)
  To: pve-devel

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 <f.gruenbichler@proxmox.com>
---
 ...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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH qemu] fix #3728: handle machine without type
  2021-11-17  9:41 [pve-devel] [PATCH qemu] fix #3728: handle machine without type Fabian Grünbichler
@ 2021-11-17 10:38 ` Dominik Csapak
  2021-11-17 16:20 ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Dominik Csapak @ 2021-11-17 10:38 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Grünbichler

was about to send basically the same patch, so ack'd by me ;)




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied: [PATCH qemu] fix #3728: handle machine without type
  2021-11-17  9:41 [pve-devel] [PATCH qemu] fix #3728: handle machine without type Fabian Grünbichler
  2021-11-17 10:38 ` Dominik Csapak
@ 2021-11-17 16:20 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2021-11-17 16:20 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Grünbichler

On 17.11.21 10:41, Fabian Grünbichler wrote:
> 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 <f.gruenbichler@proxmox.com>
> ---
>  ...E-Allow-version-code-in-machine-type.patch | 22 ++++++++++---------
>  1 file changed, 12 insertions(+), 10 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-17 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17  9:41 [pve-devel] [PATCH qemu] fix #3728: handle machine without type Fabian Grünbichler
2021-11-17 10:38 ` Dominik Csapak
2021-11-17 16:20 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal