* [PATCH] dbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies
@ 2021-11-26 6:28 Priyankar Jain
2021-11-26 11:25 ` Marc-André Lureau
0 siblings, 1 reply; 2+ messages in thread
From: Priyankar Jain @ 2021-11-26 6:28 UTC (permalink / raw)
To: qemu-devel; +Cc: Marc-André Lureau, Priyankar Jain
The purpose of dbus_get_proxies to construct the proxies corresponding to the
IDs registered to dbus-vmstate.
Currenty, this function returns an error in case there is any failure
while instantiating proxy for "all" the names on dbus.
Ideally this function should error out only if it is not able to find and
validate the proxies registered to the backend otherwise any offending
process(for eg: the process purposefully may not export its Id property on
the dbus) may connect to the dbus and can lead to migration failures.
This commit ensures that dbus_get_proxies returns an error if it is not
able to find and validate the proxies of interest(the IDs registered
during the dbus-vmstate instantiation).
Signed-off-by: Priyankar Jain <priyankar.jain@nutanix.com>
---
backends/dbus-vmstate.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/backends/dbus-vmstate.c b/backends/dbus-vmstate.c
index 9cfd758c42..ec86b5bac2 100644
--- a/backends/dbus-vmstate.c
+++ b/backends/dbus-vmstate.c
@@ -114,14 +114,13 @@ dbus_get_proxies(DBusVMState *self, GError **err)
"org.qemu.VMState1",
NULL, err);
if (!proxy) {
- return NULL;
+ continue;
}
result = g_dbus_proxy_get_cached_property(proxy, "Id");
if (!result) {
- g_set_error_literal(err, G_IO_ERROR, G_IO_ERROR_FAILED,
- "VMState Id property is missing.");
- return NULL;
+ g_clear_object(&proxy);
+ continue;
}
id = g_variant_dup_string(result, &size);
--
2.30.1 (Apple Git-130)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies
2021-11-26 6:28 [PATCH] dbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies Priyankar Jain
@ 2021-11-26 11:25 ` Marc-André Lureau
0 siblings, 0 replies; 2+ messages in thread
From: Marc-André Lureau @ 2021-11-26 11:25 UTC (permalink / raw)
To: Priyankar Jain; +Cc: QEMU
[-- Attachment #1: Type: text/plain, Size: 2090 bytes --]
Hi
On Fri, Nov 26, 2021 at 10:49 AM Priyankar Jain <priyankar.jain@nutanix.com>
wrote:
> The purpose of dbus_get_proxies to construct the proxies corresponding to
> the
> IDs registered to dbus-vmstate.
>
> Currenty, this function returns an error in case there is any failure
> while instantiating proxy for "all" the names on dbus.
>
> Ideally this function should error out only if it is not able to find and
> validate the proxies registered to the backend otherwise any offending
> process(for eg: the process purposefully may not export its Id property on
> the dbus) may connect to the dbus and can lead to migration failures.
>
ok
> This commit ensures that dbus_get_proxies returns an error if it is not
> able to find and validate the proxies of interest(the IDs registered
> during the dbus-vmstate instantiation).
>
> Signed-off-by: Priyankar Jain <priyankar.jain@nutanix.com>
> ---
> backends/dbus-vmstate.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/backends/dbus-vmstate.c b/backends/dbus-vmstate.c
> index 9cfd758c42..ec86b5bac2 100644
> --- a/backends/dbus-vmstate.c
> +++ b/backends/dbus-vmstate.c
> @@ -114,14 +114,13 @@ dbus_get_proxies(DBusVMState *self, GError **err)
> "org.qemu.VMState1",
> NULL, err);
> if (!proxy) {
> - return NULL;
>
This would leak "err", you would need to pass NULL instead. Imho we need to
report a warning anyway with "err".
> + continue;
> }
>
> result = g_dbus_proxy_get_cached_property(proxy, "Id");
> if (!result) {
> - g_set_error_literal(err, G_IO_ERROR, G_IO_ERROR_FAILED,
> - "VMState Id property is missing.");
> - return NULL;
>
Similarly, report a warning.
> + g_clear_object(&proxy);
> + continue;
> }
>
> id = g_variant_dup_string(result, &size);
> --
> 2.30.1 (Apple Git-130)
>
>
>
thanks
--
Marc-André Lureau
[-- Attachment #2: Type: text/html, Size: 3314 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-26 11:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-26 6:28 [PATCH] dbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies Priyankar Jain
2021-11-26 11:25 ` Marc-André Lureau
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).