[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/31] module: check module wasn't already initialized
From: |
Stefan Hajnoczi |
Subject: |
[PULL 12/31] module: check module wasn't already initialized |
Date: |
Sat, 22 Feb 2020 08:50:11 +0000 |
From: Alexander Bulekov <address@hidden>
The virtual-device fuzzer must initialize QOM, prior to running
vl:qemu_init, so that it can use the qos_graph to identify the arguments
required to initialize a guest for libqos-assisted fuzzing. This change
prevents errors when vl:qemu_init tries to (re)initialize the previously
initialized QOM module.
Signed-off-by: Alexander Bulekov <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Darren Kenny <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
util/module.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/util/module.c b/util/module.c
index 8c5315a7a3..236a7bb52a 100644
--- a/util/module.c
+++ b/util/module.c
@@ -30,6 +30,7 @@ typedef struct ModuleEntry
typedef QTAILQ_HEAD(, ModuleEntry) ModuleTypeList;
static ModuleTypeList init_type_list[MODULE_INIT_MAX];
+static bool modules_init_done[MODULE_INIT_MAX];
static ModuleTypeList dso_init_list;
@@ -91,11 +92,17 @@ void module_call_init(module_init_type type)
ModuleTypeList *l;
ModuleEntry *e;
+ if (modules_init_done[type]) {
+ return;
+ }
+
l = find_type(type);
QTAILQ_FOREACH(e, l, node) {
e->init();
}
+
+ modules_init_done[type] = true;
}
#ifdef CONFIG_MODULES
--
2.24.1
- [PULL 02/31] aio-posix: avoid reacquiring rcu_read_lock() when polling, (continued)
- [PULL 02/31] aio-posix: avoid reacquiring rcu_read_lock() when polling, Stefan Hajnoczi, 2020/02/22
- [PULL 03/31] rcu_queue: add QSLIST functions, Stefan Hajnoczi, 2020/02/22
- [PULL 04/31] util/async: make bh_aio_poll() O(1), Stefan Hajnoczi, 2020/02/22
- [PULL 05/31] aio-posix: fix use after leaving scope in aio_poll(), Stefan Hajnoczi, 2020/02/22
- [PULL 06/31] aio-posix: don't pass ns timeout to epoll_wait(), Stefan Hajnoczi, 2020/02/22
- [PULL 07/31] qemu/queue.h: add QLIST_SAFE_REMOVE(), Stefan Hajnoczi, 2020/02/22
- [PULL 08/31] aio-posix: make AioHandler deletion O(1), Stefan Hajnoczi, 2020/02/22
- [PULL 09/31] aio-posix: make AioHandler dispatch O(1) with epoll, Stefan Hajnoczi, 2020/02/22
- [PULL 10/31] softmmu: move vl.c to softmmu/, Stefan Hajnoczi, 2020/02/22
- [PULL 11/31] softmmu: split off vl.c:main() into main.c, Stefan Hajnoczi, 2020/02/22
- [PULL 12/31] module: check module wasn't already initialized,
Stefan Hajnoczi <=
- [PULL 13/31] fuzz: add FUZZ_TARGET module type, Stefan Hajnoczi, 2020/02/22
- [PULL 14/31] qtest: add qtest_server_send abstraction, Stefan Hajnoczi, 2020/02/22
- [PULL 15/31] libqtest: add a layer of abstraction to send/recv, Stefan Hajnoczi, 2020/02/22
- [PULL 16/31] libqtest: make bufwrite rely on the TransportOps, Stefan Hajnoczi, 2020/02/22
- [PULL 17/31] qtest: add in-process incoming command handler, Stefan Hajnoczi, 2020/02/22
- [PULL 18/31] libqos: rename i2c_send and i2c_recv, Stefan Hajnoczi, 2020/02/22
- [PULL 19/31] libqos: split qos-test and libqos makefile vars, Stefan Hajnoczi, 2020/02/22
- [PULL 21/31] fuzz: add fuzzer skeleton, Stefan Hajnoczi, 2020/02/22
- [PULL 20/31] libqos: move useful qos-test funcs to qos_external, Stefan Hajnoczi, 2020/02/22
- [PULL 22/31] exec: keep ram block across fork when using qtest, Stefan Hajnoczi, 2020/02/22