From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D5336C433F5 for ; Fri, 26 Nov 2021 13:51:20 +0000 (UTC) Received: from localhost ([::1]:46214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mqbdH-0002so-Kz for qemu-devel@archiver.kernel.org; Fri, 26 Nov 2021 08:51:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqbaT-0000o8-B8 for qemu-devel@nongnu.org; Fri, 26 Nov 2021 08:48:25 -0500 Received: from [2a00:1450:4864:20::431] (port=40831 helo=mail-wr1-x431.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mqbaK-0002Sv-C2 for qemu-devel@nongnu.org; Fri, 26 Nov 2021 08:48:19 -0500 Received: by mail-wr1-x431.google.com with SMTP id t9so1843403wrx.7 for ; Fri, 26 Nov 2021 05:48:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=G54oSutrQy9gBO7jfZLi96dlbLMUO7UrRauldhBZAzY=; b=gvutmrEPhV7z0/eEn7We1yYMieBrU32QFspC3F7AK7ALugWQsdFZla5wplp0XH5G+s LY9BjrtI7B3NGAbB4oO/pwbWGWkYBiaZSTyEMs3wK3cqgfRDJJa7QO7fNgKqUnNt2ZVC SxWH9zem1ja0t7sBV0dGWvgh+boYDwmTOlvHZT+u35LaB76AUdiOu88YaSuFJQhjrcTV wY4r2PRbTU7K58ntEhXfzgqdBX0ZrnapNXzjoR9M3HTGrVz4cFGE/oKUfUrEspPLXMjB JR3rhpTHZ3bfSlY2hy0/W7im6TOU4kt3/VspQh5tHHePONI9b+GOPrDgWa+nHd3KftfD wUig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=G54oSutrQy9gBO7jfZLi96dlbLMUO7UrRauldhBZAzY=; b=PVPCWNAEL8Ip4pvXF155HcNyMZF51HdyeajM9vZJLmINhn/Re/Dd5uyu9eyC8P/iz1 aQMD8Y/Q6wCyi2OlDbpnHE7h/cJtZtsb1bP2JftvUvJhbMFsj2vhj57dQlqAuSGX1lXS /UxXUVuaINnQDsCYoLQwgb9u/ioe0p/DJMCMB/E+JEIdRypXEZwD4bjcfhWxbY4kUzWs Z5/NAgW18s7jgHAMd7qbzlhfFV8wmxvAhvvu+gyE+vRS1We8LcZw2EjpAO9PMFMysTfO yPgzTHkeSFKsbb2RCXRKhk5Yupw2PMWNTj2O90G2Xx85+riymY+ryl3Lo4O3noA+7szl soUw== X-Gm-Message-State: AOAM530iC7W/YK7WfvF3HEeiiwY0DfQpPIQvYF4nc6PwYA0HF6KhvyuZ 4P4pPI3olrZQY+vfgpIWGkhUFaP44GohOrXoWFY= X-Google-Smtp-Source: ABdhPJxecJXwVc27CR72A03W4legcxyGuZ7VOSFibsm7N2G5XO7MtQnSsu3Nqcj7Q3ii2Qx4iLl3Q9phXEOdl4a89HI= X-Received: by 2002:adf:ea8c:: with SMTP id s12mr13940643wrm.535.1637934494972; Fri, 26 Nov 2021 05:48:14 -0800 (PST) MIME-Version: 1.0 References: <1637933911-37482-1-git-send-email-priyankar.jain@nutanix.com> In-Reply-To: <1637933911-37482-1-git-send-email-priyankar.jain@nutanix.com> From: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Date: Fri, 26 Nov 2021 17:48:03 +0400 Message-ID: Subject: Re: [PATCH v2] dbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies To: Priyankar Jain Content-Type: multipart/alternative; boundary="000000000000bd000d05d1b15701" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::431 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=marcandre.lureau@gmail.com; helo=mail-wr1-x431.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --000000000000bd000d05d1b15701 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Nov 26, 2021 at 5:40 PM Priyankar Jain 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 o= n > 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 > Reviewed-by: Marc-Andr=C3=A9 Lureau 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 !=3D NULL && *err !=3D NULL) { > + warn_report("%s: Failed to create proxy: %s", > + __func__, (*err)->message); > + g_clear_error(err); > + } > + continue; > } > > result =3D 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 =3D g_variant_dup_string(result, &size); > -- > 2.30.1 (Apple Git-130) > > > --=20 Marc-Andr=C3=A9 Lureau --000000000000bd000d05d1b15701 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, Nov 26, 2021 at 5:40 PM Priya= nkar Jain <priyankar.jain@= nutanix.com> wrote:
The purpose of dbus_get_proxies to construct the proxies corresp= onding 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<= br> 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>
<= div>
Reviewed-by: Marc-Andr=C3=A9 Lureau <marcandre.lureau@redhat.com>

thanks

---
=C2=A0backends/dbus-vmstate.c | 13 +++++++++----
=C2=A01 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)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0"org.qemu.VMState1",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0NULL, err);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!proxy) {
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return NULL;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (err !=3D NULL && *er= r !=3D NULL) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 warn_report("= %s: Failed to create proxy: %s",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 __func__, (*err)->message);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 g_clear_error(err)= ;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 continue;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0result =3D g_dbus_proxy_get_cached_proper= ty(proxy, "Id");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!result) {
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 g_set_error_literal(err, G_IO_ER= ROR, G_IO_ERROR_FAILED,
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "VMState Id property is missing= .");
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return NULL;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 warn_report("%s: VMState Id= property is missing.", __func__);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 g_clear_object(&proxy);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 continue;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0id =3D g_variant_dup_string(result, &= size);
--
2.30.1 (Apple Git-130)




--
Marc-Andr=C3=A9 Lureau
--000000000000bd000d05d1b15701--