[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.0.1 72/73] machine: do not crash if default RAM backend name h
From: |
Michael Tokarev |
Subject: |
[Stable-8.0.1 72/73] machine: do not crash if default RAM backend name has been stolen |
Date: |
Sun, 28 May 2023 09:57:10 +0300 |
From: Igor Mammedov <imammedo@redhat.com>
QEMU aborts when default RAM backend should be used (i.e. no
explicit '-machine memory-backend=' specified) but user
has created an object which 'id' equals to default RAM backend
name used by board.
$QEMU -machine pc \
-object memory-backend-ram,id=pc.ram,size=4294967296
Actual results:
QEMU 7.2.0 monitor - type 'help' for more information
(qemu) Unexpected error in object_property_try_add() at ../qom/object.c:1239:
qemu-kvm: attempt to add duplicate property 'pc.ram' to object (type
'container')
Aborted (core dumped)
Instead of abort, check for the conflicting 'id' and exit with
an error, suggesting how to remedy the issue.
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2207886
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230522131717.3780533-1-imammedo@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit a37531f2381c4e294e48b1417089474128388b44)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 5060119952..2f6ccf5623 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1333,6 +1333,14 @@ void machine_run_board_init(MachineState *machine, const
char *mem_path, Error *
}
} else if (machine_class->default_ram_id && machine->ram_size &&
numa_uses_legacy_mem()) {
+ if (object_property_find(object_get_objects_root(),
+ machine_class->default_ram_id)) {
+ error_setg(errp, "object name '%s' is reserved for the default"
+ " RAM backend, it can't be used for any other purposes."
+ " Change the object's 'id' to something else",
+ machine_class->default_ram_id);
+ return;
+ }
if (!create_default_memdev(current_machine, mem_path, errp)) {
return;
}
--
2.39.2
- [Stable-8.0.1 62/73] igb: Fix Rx packet type encoding, (continued)
- [Stable-8.0.1 62/73] igb: Fix Rx packet type encoding, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 61/73] e1000x: Fix BPRC and MPRC, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 63/73] igb: Do not require CTRL.VME for tx VLAN tagging, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 66/73] e1000e: Always copy ethernet header, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 65/73] net/net_rx_pkt: Use iovec for net_rx_pkt_set_protocols(), Michael Tokarev, 2023/05/28
- [Stable-8.0.1 64/73] igb: Clear IMS bits when committing ICR access, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 67/73] igb: Always copy ethernet header, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 68/73] rtl8139: fix large_send_mss divide-by-zero, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 69/73] util/vfio-helpers: Use g_file_read_link(), Michael Tokarev, 2023/05/28
- [Stable-8.0.1 70/73] usb/ohci: Set pad to 0 after frame update, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 72/73] machine: do not crash if default RAM backend name has been stolen,
Michael Tokarev <=
- [Stable-8.0.1 71/73] hw/scsi/lsi53c895a: Fix reentrancy issues in the LSI controller (CVE-2023-0330), Michael Tokarev, 2023/05/28
- [Stable-8.0.1 73/73] virtio: qmp: fix memory leak, Michael Tokarev, 2023/05/28