86ffd40d11
- Switch method of splitting off hw-s390x-virtio-gpu-ccw.so as a module to what was accepted upstream (bsc#1181103) * Patches dropped: hw-s390x-modularize-virtio-gpu-ccw.patch * Patches added: s390x-add-have_virtio_ccw.patch s390x-modularize-virtio-gpu-ccw.patch s390x-move-S390_ADAPTER_SUPPRESSIBLE.patch - Fix OOB access in sdhci interface (CVE-2020-17380, bsc#1175144, CVE-2020-25085, bsc#1176681, CVE-2021-3409, bsc#1182282) hw-sd-sd-Actually-perform-the-erase-oper.patch hw-sd-sd-Fix-build-error-when-DEBUG_SD-i.patch hw-sd-sdhci-Correctly-set-the-controller.patch hw-sd-sdhci-Don-t-transfer-any-data-when.patch hw-sd-sdhci-Don-t-write-to-SDHC_SYSAD-re.patch hw-sd-sdhci-Limit-block-size-only-when-S.patch hw-sd-sdhci-Reset-the-data-pointer-of-s-.patch hw-sd-sd-Move-the-sd_block_-read-write-a.patch hw-sd-sd-Skip-write-protect-groups-check.patch - Fix potential privilege escalation in virtiofsd tool (CVE-2021-20263, bsc#1183373) tools-virtiofsd-Replace-the-word-whiteli.patch viriofsd-Add-support-for-FUSE_HANDLE_KIL.patch virtiofsd-extract-lo_do_open-from-lo_ope.patch virtiofsd-optionally-return-inode-pointe.patch virtiofsd-prevent-opening-of-special-fil.patch virtiofs-drop-remapped-security.capabili.patch virtiofsd-Save-error-code-early-at-the-f.patch - Fix OOB access (stack overflow) in rtl8139 NIC emulation (CVE-2021-3416, bsc#1182968) net-introduce-qemu_receive_packet.patch rtl8139-switch-to-use-qemu_receive_packe.patch - Fix OOB access (stack overflow) in other NIC emulations (CVE-2021-3416) cadence_gem-switch-to-use-qemu_receive_p.patch dp8393x-switch-to-use-qemu_receive_packe.patch e1000-switch-to-use-qemu_receive_packet-.patch lan9118-switch-to-use-qemu_receive_packe.patch msf2-mac-switch-to-use-qemu_receive_pack.patch pcnet-switch-to-use-qemu_receive_packet-.patch sungem-switch-to-use-qemu_receive_packet.patch tx_pkt-switch-to-use-qemu_receive_packet.patch - Fix heap overflow in MSIx emulation (CVE-2020-27821, bsc#1179686) memory-clamp-cached-translation-in-case-.patch - Include upstream patches designated as stable material and reviewed for applicability to include here hw-arm-virt-Disable-pl011-clock-migratio.patch xen-block-Fix-removal-of-backend-instanc.patch - Fix package scripts to not use hard coded paths for temporary working directories and log files (bsc#1182425) OBS-URL: https://build.opensuse.org/request/show/882222 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=632
114 lines
3.9 KiB
Diff
114 lines
3.9 KiB
Diff
From: Bruce Rogers <brogers@suse.com>
|
|
Date: Thu, 21 Jan 2021 16:34:32 -0700
|
|
Subject: module: for virtio-gpu, pre-load module to avoid abort on missing
|
|
module
|
|
|
|
If the hw-display-virtio-gpu module is not loadable when the virtio-gpu
|
|
device is referenced either on the command line or the monitor, qemu
|
|
will call abort. We can fail gracefully by moving the attempted module
|
|
load to a context better situated to handle errors properly. (bsc#1181103)
|
|
|
|
Signed-off-by: Bruce Rogers <brogers@suse.com>
|
|
---
|
|
include/qemu/module.h | 1 +
|
|
qom/object.c | 12 ++++++++++++
|
|
qom/qom-qmp-cmds.c | 17 +++++++++++++++++
|
|
softmmu/qdev-monitor.c | 15 +++++++++++++++
|
|
4 files changed, 45 insertions(+)
|
|
|
|
diff --git a/include/qemu/module.h b/include/qemu/module.h
|
|
index 944d403cbd1535cc121af76a94f2..4b42dd285eeac1ba12e5c9e18ac0 100644
|
|
--- a/include/qemu/module.h
|
|
+++ b/include/qemu/module.h
|
|
@@ -72,5 +72,6 @@ void module_call_init(module_init_type type);
|
|
bool module_load_one(const char *prefix, const char *lib_name, bool mayfail);
|
|
void module_load_qom_one(const char *type);
|
|
void module_load_qom_all(void);
|
|
+int module_load_check(const char *name);
|
|
|
|
#endif
|
|
diff --git a/qom/object.c b/qom/object.c
|
|
index 10653552334549241cd5672d7a02..6f301fec34d103b0b07bc41d107c 100644
|
|
--- a/qom/object.c
|
|
+++ b/qom/object.c
|
|
@@ -516,6 +516,18 @@ static void object_initialize_with_type(Object *obj, size_t size, TypeImpl *type
|
|
object_post_init_with_type(obj, type);
|
|
}
|
|
|
|
+#ifdef CONFIG_MODULES
|
|
+int module_load_check(const char *name)
|
|
+{
|
|
+ TypeImpl *type = type_get_by_name(name);
|
|
+ if (!type) {
|
|
+ module_load_qom_one(name);
|
|
+ type = type_get_by_name(name);
|
|
+ }
|
|
+ return type == NULL;
|
|
+}
|
|
+#endif
|
|
+
|
|
void object_initialize(void *data, size_t size, const char *typename)
|
|
{
|
|
TypeImpl *type = type_get_by_name(typename);
|
|
diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c
|
|
index 310ab2d0481d1517b0432be23256..cf130dc875bb6a7921fd7fb5af26 100644
|
|
--- a/qom/qom-qmp-cmds.c
|
|
+++ b/qom/qom-qmp-cmds.c
|
|
@@ -131,6 +131,23 @@ ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
|
|
ObjectPropertyIterator iter;
|
|
ObjectPropertyInfoList *prop_list = NULL;
|
|
|
|
+#ifdef CONFIG_MODULES
|
|
+ if (!strcmp(typename, "virtio-gpu-pci") || !strcmp(typename, "virtio-gpu-ccw")) {
|
|
+ if (module_load_check("virtio-gpu-device")) {
|
|
+ ObjectPropertyInfo *info;
|
|
+ info = g_new0(ObjectPropertyInfo, 1);
|
|
+ info->name = g_strdup("dummy");
|
|
+ info->type = g_strdup("dummy");
|
|
+ info->has_description = false;
|
|
+ info->description = NULL;
|
|
+ info->default_value = 0;
|
|
+ info->has_default_value = 0;
|
|
+ QAPI_LIST_PREPEND(prop_list, info);
|
|
+ return prop_list;
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
+
|
|
klass = module_object_class_by_name(typename);
|
|
if (klass == NULL) {
|
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
|
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
|
|
index bf79d0bbcd986320eb609f37253e..564dfaeeda9c3ae9dbf1afa97825 100644
|
|
--- a/softmmu/qdev-monitor.c
|
|
+++ b/softmmu/qdev-monitor.c
|
|
@@ -263,6 +263,13 @@ int qdev_device_help(QemuOpts *opts)
|
|
int i;
|
|
|
|
driver = qemu_opt_get(opts, "driver");
|
|
+#ifdef CONFIG_MODULES
|
|
+ if (driver && !strcmp(driver, "virtio-gpu")) {
|
|
+ if (module_load_check("virtio-gpu-device")) {
|
|
+ return 0;
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
if (driver && is_help_option(driver)) {
|
|
qdev_print_devinfos(false);
|
|
return 1;
|
|
@@ -650,6 +657,14 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
|
|
return NULL;
|
|
}
|
|
|
|
+#ifdef CONFIG_MODULES
|
|
+ if (!strcmp(driver, "virtio-gpu-pci") || !strcmp(driver, "virtio-gpu-ccw")) {
|
|
+ if (module_load_check("virtio-gpu-device")) {
|
|
+ error_setg(errp, "loadable module for %s not available!", driver);
|
|
+ return NULL;
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
/* create device */
|
|
dev = qdev_new(driver);
|
|
|