67 lines
2.0 KiB
Diff
67 lines
2.0 KiB
Diff
|
From: "Jose R. Ziviani" <jziviani@suse.de>
|
||
|
Date: Thu, 16 Sep 2021 00:52:34 -0300
|
||
|
Subject: modules: quick-fix a fundamental error in modules
|
||
|
|
||
|
Signed-off-by: Jose R. Ziviani <jziviani@suse.de>
|
||
|
---
|
||
|
include/qemu/module.h | 1 +
|
||
|
util/module.c | 26 ++++++++++++++++++++++++++
|
||
|
2 files changed, 27 insertions(+)
|
||
|
|
||
|
diff --git a/include/qemu/module.h b/include/qemu/module.h
|
||
|
index 3deac0078b9d4d62d0549427b7ec..49d46532000e8c7211d43f7b705c 100644
|
||
|
--- a/include/qemu/module.h
|
||
|
+++ b/include/qemu/module.h
|
||
|
@@ -73,6 +73,7 @@ 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);
|
||
|
void module_allow_arch(const char *arch);
|
||
|
+bool s390x_blocklist(const char *name);
|
||
|
|
||
|
/**
|
||
|
* DOC: module info annotation macros
|
||
|
diff --git a/util/module.c b/util/module.c
|
||
|
index 6bb4ad915a1c86f1601a4913a29c..485c137c79e9d4e45c4708bb8017 100644
|
||
|
--- a/util/module.c
|
||
|
+++ b/util/module.c
|
||
|
@@ -119,6 +119,28 @@ static const QemuModinfo module_info_stub[] = { {
|
||
|
static const QemuModinfo *module_info = module_info_stub;
|
||
|
static const char *module_arch;
|
||
|
|
||
|
+bool s390x_blocklist(const char *name)
|
||
|
+{
|
||
|
+ const char *blocklist[] = {
|
||
|
+ "hw-display-qxl",
|
||
|
+ "hw-display-virtio-vga",
|
||
|
+ "hw-display-virtio-vga-gl",
|
||
|
+ "hw-usb-host",
|
||
|
+ "hw-usb-redirect",
|
||
|
+ "hw-usb-smartcard"
|
||
|
+ };
|
||
|
+
|
||
|
+ const size_t len = sizeof(blocklist) / sizeof(blocklist[0]);
|
||
|
+
|
||
|
+ for (size_t i = 0; i < len; i++) {
|
||
|
+ if (strcmp(blocklist[i], name) == 0) {
|
||
|
+ return true;
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ return false;
|
||
|
+}
|
||
|
+
|
||
|
void module_init_info(const QemuModinfo *info)
|
||
|
{
|
||
|
module_info = info;
|
||
|
@@ -131,6 +153,10 @@ void module_allow_arch(const char *arch)
|
||
|
|
||
|
static bool module_check_arch(const QemuModinfo *modinfo)
|
||
|
{
|
||
|
+ if (modinfo->name && s390x_blocklist(modinfo->name)) {
|
||
|
+ return false;
|
||
|
+ }
|
||
|
+
|
||
|
if (modinfo->arch) {
|
||
|
if (!module_arch) {
|
||
|
/* no arch set -> ignore all */
|