All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@gmail.com>
To: Priyankar Jain <priyankar.jain@nutanix.com>
Cc: QEMU <qemu-devel@nongnu.org>
Subject: Re: [PATCH v2] dbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies
Date: Fri, 26 Nov 2021 17:48:03 +0400	[thread overview]
Message-ID: <CAJ+F1CJJn9K-dOrNg_xD3n1OOSnQWeO8iKO63zEiQ70HOHcFEA@mail.gmail.com> (raw)
In-Reply-To: <1637933911-37482-1-git-send-email-priyankar.jain@nutanix.com>

[-- Attachment #1: Type: text/plain, Size: 2301 bytes --]

On Fri, Nov 26, 2021 at 5:40 PM 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.
>
> 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>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

thanks

---
>  backends/dbus-vmstate.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/backends/dbus-vmstate.c b/backends/dbus-vmstate.c
> index 9cfd758c42..57369ec0f2 100644
> --- a/backends/dbus-vmstate.c
> +++ b/backends/dbus-vmstate.c
> @@ -114,14 +114,19 @@ dbus_get_proxies(DBusVMState *self, GError **err)
>                      "org.qemu.VMState1",
>                      NULL, err);
>          if (!proxy) {
> -            return NULL;
> +            if (err != NULL && *err != NULL) {
> +                warn_report("%s: Failed to create proxy: %s",
> +                            __func__, (*err)->message);
> +                g_clear_error(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;
> +            warn_report("%s: VMState Id property is missing.", __func__);
> +            g_clear_object(&proxy);
> +            continue;
>          }
>
>          id = g_variant_dup_string(result, &size);
> --
> 2.30.1 (Apple Git-130)
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 3334 bytes --]

      reply	other threads:[~2021-11-26 13:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26 13:38 [PATCH v2] dbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies Priyankar Jain
2021-11-26 13:48 ` Marc-André Lureau [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=CAJ+F1CJJn9K-dOrNg_xD3n1OOSnQWeO8iKO63zEiQ70HOHcFEA@mail.gmail.com \
    --to=marcandre.lureau@gmail.com \
    --cc=priyankar.jain@nutanix.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.