From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: qemu-devel@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
"Konstantin Kostiuk" <kkostiuk@redhat.com>,
"Michael Roth" <michael.roth@amd.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH 20/20] qga: centralize logic for disabling/enabling commands
Date: Wed, 5 Jun 2024 11:41:56 +0100 [thread overview]
Message-ID: <ZmBA9JfW8rTMu-OD@redhat.com> (raw)
In-Reply-To: <CAJ+F1CKE412ZvLJQRSfvO_gV1irUyQxP0xZ+Ejfuqf=QxeS+Tg@mail.gmail.com>
On Wed, Jun 05, 2024 at 02:37:24PM +0400, Marc-André Lureau wrote:
> Hi
>
> On Tue, Jun 4, 2024 at 5:51 PM Daniel P. Berrangé <berrange@redhat.com>
> wrote:
>
> > It is confusing having many different pieces of code enabling and
> > disabling commands, and it is not clear that they all have the same
> > semantics, especially wrt prioritization of the block/allow lists.
> >
> > Centralizing the code in a single method "ga_apply_command_filters"
> > will provide a strong guarantee of consistency and clarify the
> > intended behaviour.
> >
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> >
>
> The clean up is very much welcome and looks correct, but it crashes:
>
> Thread 1 "qemu-ga" received signal SIGSEGV, Segmentation fault.
> 0x000055555557db4f in ga_command_is_allowed (cmd=0x555555632800,
> state=0x555555633710) at ../qga/main.c:430
> 430 if (config->allowedrpcs) {
> (gdb) bt
> #0 0x000055555557db4f in ga_command_is_allowed (cmd=0x555555632800,
> state=0x555555633710) at ../qga/main.c:430
> #1 ga_apply_command_filters_iter (cmd=0x555555632800,
> opaque=0x555555633710) at ../qga/main.c:473
> #2 0x000055555559ef81 in qmp_for_each_command (cmds=cmds@entry=0x55555562c2b0
> <ga_commands>, fn=fn@entry=0x55555557db30 <ga_apply_command_filters_iter>,
> opaque=opaque@entry=0x555555633710)
> at ../qapi/qmp-registry.c:93
> #3 0x0000555555571436 in ga_apply_command_filters (state=0x555555633710)
> at ../qga/main.c:492
> #4 initialize_agent (config=0x555555632760, socket_activation=0) at
> ../qga/main.c:1452
> #5 main (argc=<optimized out>, argv=<optimized out>) at ../qga/main.c:1646
> (gdb) p state.config
> $1 = (GAConfig *) 0x0
>
> (meson test fails too)
>
> I wonder why s->config is set so late in initialize_agent(). Moving it
> earlier seems to solve the issue, but reviewing all code paths is tedious..
The ga_apply_command_filters() call can just be moved later,
since the only constraint is that is called /before/ we call
g_main_loop_run() to start processing I/O
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
prev parent reply other threads:[~2024-06-05 10:42 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 13:49 [PATCH 00/20] qga: clean up command source locations and conditionals Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 01/20] qga: drop blocking of guest-get-memory-block-size command Daniel P. Berrangé
2024-06-06 8:05 ` Manos Pitsidianakis
2024-06-04 13:49 ` [PATCH 02/20] qga: move linux vcpu command impls to commands-linux.c Daniel P. Berrangé
2024-06-06 8:08 ` Manos Pitsidianakis
2024-06-04 13:49 ` [PATCH 03/20] qga: move linux suspend " Daniel P. Berrangé
2024-06-06 8:17 ` Manos Pitsidianakis
2024-06-04 13:49 ` [PATCH 04/20] qga: move linux fs/disk " Daniel P. Berrangé
2024-06-06 8:19 ` Manos Pitsidianakis
2024-06-04 13:49 ` [PATCH 05/20] qga: move linux disk/cpu stats " Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 06/20] qga: move linux memory block " Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 07/20] qga: move CONFIG_FSFREEZE/TRIM to be meson defined options Daniel P. Berrangé
2024-06-05 8:47 ` Marc-André Lureau
2024-06-05 8:53 ` Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 08/20] qga: conditionalize schema for commands unsupported on Windows Daniel P. Berrangé
2024-06-11 9:13 ` Markus Armbruster
2024-06-13 11:26 ` Daniel P. Berrangé
2024-06-11 13:55 ` Markus Armbruster
2024-06-11 14:03 ` Daniel P. Berrangé
2024-06-13 11:43 ` Daniel P. Berrangé
2024-06-13 11:55 ` Konstantin Kostiuk
2024-06-04 13:49 ` [PATCH 09/20] qga: conditionalize schema for commands unsupported on non-Linux POSIX Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 10/20] qga: conditionalize schema for commands requiring getifaddrs Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 11/20] qga: conditionalize schema for commands requiring linux/win32 Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 12/20] qga: conditionalize schema for commands only supported on Windows Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 13/20] qga: conditionalize schema for commands requiring fsfreeze Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 14/20] qga: conditionalize schema for commands requiring fstrim Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 15/20] qga: conditionalize schema for commands requiring libudev Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 16/20] qga: conditionalize schema for commands requiring utmpx Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 17/20] qga: conditionalize schema for commands not supported on other UNIX Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 18/20] qga: add note about where to disable commands for a platform Daniel P. Berrangé
2024-06-11 8:08 ` Markus Armbruster
2024-06-11 8:49 ` Daniel P. Berrangé
2024-06-13 11:48 ` Daniel P. Berrangé
2024-06-04 13:49 ` [PATCH 19/20] qga: move declare of QGAConfig struct to top of file Daniel P. Berrangé
2024-06-05 9:58 ` Marc-André Lureau
2024-06-04 13:49 ` [PATCH 20/20] qga: centralize logic for disabling/enabling commands Daniel P. Berrangé
2024-06-05 10:37 ` Marc-André Lureau
2024-06-05 10:39 ` Marc-André Lureau
2024-06-05 10:41 ` Daniel P. Berrangé [this message]
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=ZmBA9JfW8rTMu-OD@redhat.com \
--to=berrange@redhat.com \
--cc=kkostiuk@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).