From: Markus Armbruster <armbru@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
qemu-devel@nongnu.org, kraxel@redhat.com
Subject: Automatic module loading (was: [PATCH] qemu-config: load modules when instantiating option groups)
Date: Wed, 19 May 2021 15:14:54 +0200 [thread overview]
Message-ID: <87h7iyoofl.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20210518131542.2941207-1-pbonzini@redhat.com> (Paolo Bonzini's message of "Tue, 18 May 2021 09:15:42 -0400")
Paolo Bonzini <pbonzini@redhat.com> writes:
> Right now the SPICE module is special cased to be loaded when processing
> of the -spice command line option. However, the spice option group
> can also be brought in via -readconfig, in which case the module is
> not loaded.
>
> Add a generic hook to load modules that provide a QemuOpts group,
> and use it for the "spice" and "iscsi" groups.
>
> Fixes: #194
> Fixes: https://bugs.launchpad.net/qemu/+bug/1910696
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
What follows is not an objection to this patch.
I think we have this kind of bugs because we're kind of wobbly on when
to load modules.
On the one hand, we're trying to load modules only when needed. This is
obviously useful to conserve resources, and to keep the attack surface
small. Some background in
Message-ID: <20210409064642.ah2tz5vjz2ngfiyo@sirius.home.kraxel.org>
https://lists.gnu.org/archive/html/qemu-devel/2021-04/msg01393.html
On the other hand, we're trying to make modules transparent to
management applications, i.e. QEMU looks the same whether something was
compiled as a loadable module or linked into QEMU itself. See
Message-ID: <YHAhQWdX15V54U8G@redhat.com>
https://lists.gnu.org/archive/html/qemu-devel/2021-04/msg01450.html
I'm afraid we sort of fail at both.
Transparency to management applications requires us to load modules on
QOM introspection already.
Example: to answer "show me all QOM types", we need to load all modules
that could possibly register QOM types. As long as module code can do
whatever it wants, that means loading all of them.
Example: to answer "show me QOM type FOO", where FOO is currently
unknown, we need to load all modules that could possible register QOM
type FOO. Again, that means loading all of them.
We don't actually do this. Instead, we hardcode a map from type name to
module name[*], so we don't have to load them all, and we actually load
the module specified by this map only sometimes, namely when we call
module_object_class_by_name() instead of object_class_by_name(). I
can't discern rules when to call which one. Wobbly.
Things other than QOM might be affected, too.
QAPI introspection is not: the value of query-qmp-schema is fixed at
compile-time, and *how* something is compiled (loadable module
vs. linked into QEMU itself) does not affect it.
I'd like us to develop a clearer understanding when exactly modules are
to be loaded.
[*] qom_modules[] in util/module.c. This is a basically an (unchecked)
assertion that the (unrelated!) module code won't register anything
else. Ugh!
next prev parent reply other threads:[~2021-05-19 13:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 13:15 [PATCH] qemu-config: load modules when instantiating option groups Paolo Bonzini
2021-05-18 13:21 ` no-reply
2021-05-19 5:24 ` Gerd Hoffmann
2021-05-19 13:14 ` Markus Armbruster [this message]
2021-05-19 14:49 ` Automatic module loading (was: [PATCH] qemu-config: load modules when instantiating option groups) Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h7iyoofl.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.