From nobody Thu May 16 23:20:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1658913816; cv=none; d=zohomail.com; s=zohoarc; b=cQxB6/mRx2fhm6sPn44tVrql1p/VEXRXqFMXMpvQ37Pa+9hzfxD1TVQtHx6ICGCGIxAPg+KO70awOif9ZPlrb44FJ5XaRzEjZLUmiRQY+4DzSWB20hyHV+OX1Ib6Pdvjbxt3tNiqNV7zu4A+v3oV0KcTaPDP4OVd/tzHRncJRDM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658913816; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=b7E52Yw+qU8n+tA0+HHOkK58HGtvoypfpIYgC64H3JM=; b=Bl2XJbsk8IsWOepDVagntsp3KtIjVCAPGHen3UxYBPOUZA1yJ83tczTMNxbmnO0Wi19OoP5V/Uy/MKPzeiPExvdaiF6diCzAPJfiNUkrcp7pmLzKhLBbH3NByCAn19kJcsDRuHFgkvDIVHTEBxciR/lxAZX9jzFI9eqPRgJJ1Hc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1658913816313779.4176477973452; Wed, 27 Jul 2022 02:23:36 -0700 (PDT) Received: from localhost ([::1]:44874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGdGR-00078Z-1J for importer@patchew.org; Wed, 27 Jul 2022 05:23:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGdEr-00056z-8d for qemu-devel@nongnu.org; Wed, 27 Jul 2022 05:21:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23318) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGdEg-0002Kt-OJ for qemu-devel@nongnu.org; Wed, 27 Jul 2022 05:21:56 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-630-JeRTGOYgPHOuFRka5V5m4w-1; Wed, 27 Jul 2022 05:21:43 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6234A101A54E; Wed, 27 Jul 2022 09:21:43 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CB5A492C3B; Wed, 27 Jul 2022 09:21:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658913705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b7E52Yw+qU8n+tA0+HHOkK58HGtvoypfpIYgC64H3JM=; b=dEqj76xkzo2WetjdK4w5788OpN/wrmsfZugrxBHqynPsb26khN90O8J9p1Zlgu03nss1Tk m9SlHUxr/F4pv3gjnwHas0kkLZ/0eRlW8qQI81xtq2T5Crj6k5LBsGJlWFUQ2f/mb2SiG1 XzDy7v9ZH8UVv+zIZhNVhfxI6qfLWk0= X-MC-Unique: JeRTGOYgPHOuFRka5V5m4w-1 From: Thomas Huth To: Michael Roth , Konstantin Kostiuk , qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , BALATON Zoltan , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 1/3] qga: Replace 'blacklist' command line and config file options by 'block-rpcs' Date: Wed, 27 Jul 2022 11:21:33 +0200 Message-Id: <20220727092135.302915-2-thuth@redhat.com> In-Reply-To: <20220727092135.302915-1-thuth@redhat.com> References: <20220727092135.302915-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658913817948100002 Let's use a more appropriate wording for this command line and config file option. The old ones are still accepted for compatibility reasons, but marked as deprecated now so that it could be removed in a future version of QEMU. This change is based on earlier patches from Philippe Mathieu-Daud=C3=A9, with the idea for the new option name suggested by BALATON Zoltan. And while we're at it, replace the "?" in the help text with "help" since that does not have the problem of conflicting with the wildcard character of the shells. Signed-off-by: Thomas Huth Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Konstantin Kostiuk --- docs/about/deprecated.rst | 19 +++++++++++++++++++ docs/interop/qemu-ga.rst | 8 ++++---- qga/main.c | 18 +++++++++++++----- tests/unit/test-qga.c | 2 +- tests/data/test-qga-config | 2 +- 5 files changed, 38 insertions(+), 11 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 7ee26626d5..61c505db97 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -379,3 +379,22 @@ be deleted from this tree. New deployments should use the Rust version, and existing systems should consider moving to it. The command line and feature set is very close and moving should be simple. + + +QEMU guest agent +---------------- + +``--blacklist`` command line option (since 7.2) +''''''''''''''''''''''''''''''''''''''''''''''' + +``--blacklist`` has been replaced by ``--block-rpcs`` (which is a better +wording for what this option does). The short form ``-b`` still stays +the same and thus is the preferred way for scripts that should run with +both, older and future versions of QEMU. + +``blacklist`` config file option (since 7.2) +'''''''''''''''''''''''''''''''''''''''''''' + +The ``blacklist`` config file option has been renamed to ``block-rpcs`` +(to be in sync with the renaming of the corresponding command line +option). diff --git a/docs/interop/qemu-ga.rst b/docs/interop/qemu-ga.rst index 3063357bb5..a9183802d1 100644 --- a/docs/interop/qemu-ga.rst +++ b/docs/interop/qemu-ga.rst @@ -79,10 +79,10 @@ Options =20 Daemonize after startup (detach from terminal). =20 -.. option:: -b, --blacklist=3DLIST +.. option:: -b, --block-rpcs=3DLIST =20 - Comma-separated list of RPCs to disable (no spaces, ``?`` to list - available RPCs). + Comma-separated list of RPCs to disable (no spaces, use ``help`` to + list available RPCs). =20 .. option:: -D, --dump-conf =20 @@ -125,7 +125,7 @@ pidfile string fsfreeze-hook string statedir string verbose boolean -blacklist string list +block-rpcs string list =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 See also diff --git a/qga/main.c b/qga/main.c index 5f1efa2333..74e5c9b10c 100644 --- a/qga/main.c +++ b/qga/main.c @@ -260,8 +260,8 @@ QEMU_COPYRIGHT "\n" #ifdef _WIN32 " -s, --service service commands: install, uninstall, vss-install, vs= s-uninstall\n" #endif -" -b, --blacklist comma-separated list of RPCs to disable (no spaces, \= "?\"\n" -" to list available RPCs)\n" +" -b, --block-rpcs comma-separated list of RPCs to disable (no spaces,\n" +" use \"help\" to list available RPCs)\n" " -D, --dump-conf dump a qemu-ga config file based on current config\n" " options / command-line parameters to stdout\n" " -r, --retry-path attempt re-opening path if it's unavailable or closed= \n" @@ -963,6 +963,7 @@ static void config_load(GAConfig *config) GError *gerr =3D NULL; GKeyFile *keyfile; g_autofree char *conf =3D g_strdup(g_getenv("QGA_CONF")) ?: get_reloca= ted_path(QGA_CONF_DEFAULT); + const gchar *blockrpcs_key =3D "block-rpcs"; =20 /* read system config */ keyfile =3D g_key_file_new(); @@ -1009,9 +1010,15 @@ static void config_load(GAConfig *config) config->retry_path =3D g_key_file_get_boolean(keyfile, "general", "retry-path", &gerr= ); } + if (g_key_file_has_key(keyfile, "general", "blacklist", NULL)) { + g_warning("config using deprecated 'blacklist' key, should be repl= aced" + " with the 'block-rpcs' key."); + blockrpcs_key =3D "blacklist"; + } + if (g_key_file_has_key(keyfile, "general", blockrpcs_key, NULL)) { config->bliststr =3D - g_key_file_get_string(keyfile, "general", "blacklist", &gerr); + g_key_file_get_string(keyfile, "general", blockrpcs_key, &gerr= ); config->blacklist =3D g_list_concat(config->blacklist, split_list(config->bliststr, ","= )); } @@ -1073,7 +1080,7 @@ static void config_dump(GAConfig *config) g_key_file_set_boolean(keyfile, "general", "retry-path", config->retry_path); tmp =3D list_join(config->blacklist, ','); - g_key_file_set_string(keyfile, "general", "blacklist", tmp); + g_key_file_set_string(keyfile, "general", "block-rpcs", tmp); g_free(tmp); =20 tmp =3D g_key_file_to_data(keyfile, NULL, &error); @@ -1105,7 +1112,8 @@ static void config_parse(GAConfig *config, int argc, = char **argv) { "method", 1, NULL, 'm' }, { "path", 1, NULL, 'p' }, { "daemonize", 0, NULL, 'd' }, - { "blacklist", 1, NULL, 'b' }, + { "block-rpcs", 1, NULL, 'b' }, + { "blacklist", 1, NULL, 'b' }, /* deprecated alias for 'block-rpc= s' */ #ifdef _WIN32 { "service", 1, NULL, 's' }, #endif diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c index 530317044b..c398866f46 100644 --- a/tests/unit/test-qga.c +++ b/tests/unit/test-qga.c @@ -729,7 +729,7 @@ static void test_qga_config(gconstpointer data) g_assert_true(g_key_file_get_boolean(kf, "general", "verbose", &error)= ); g_assert_no_error(error); =20 - strv =3D g_key_file_get_string_list(kf, "general", "blacklist", &n, &e= rror); + strv =3D g_key_file_get_string_list(kf, "general", "block-rpcs", &n, &= error); g_assert_cmpint(n, =3D=3D, 2); g_assert_true(g_strv_contains((const char * const *)strv, "guest-ping")); diff --git a/tests/data/test-qga-config b/tests/data/test-qga-config index 4bb721a4a1..b6b7bc9dfd 100644 --- a/tests/data/test-qga-config +++ b/tests/data/test-qga-config @@ -5,4 +5,4 @@ path=3D/path/to/org.qemu.guest_agent.0 pidfile=3D/var/foo/qemu-ga.pid statedir=3D/var/state verbose=3Dtrue -blacklist=3Dguest-ping;guest-get-time +block-rpcs=3Dguest-ping;guest-get-time --=20 2.31.1 From nobody Thu May 16 23:20:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1658913817; cv=none; d=zohomail.com; s=zohoarc; b=d1OkrrNSPMpQLgCSjG+kLlYtNljgasYagWskIKcSDPNduILYRZFf5xqjCVLBS4uq4sLxZkk4LbUSNMDixYBLYzm52PXd/6IO17Ybr6YdlJ4NkECyPz53eJDoWElLex8+1vcE/z2HEsif+y9nCNDdDfeHoxC+d6GkYJS+kgVNHxk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658913817; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=o5I0SevDO12E2oHsF17QadEpWSZOQGdfROrC/PH4sQQ=; b=Xizzt+Ovs3UtmFn31kfxFfTHupRVU4iaf/KC56l7Prid4qyDz8xSDRPnkc9zJ8lxg5r2+nOr4sMF89KgwUTJhNZg6QyCti38SJiuquffDQEGSDoGLM9aR1kNTxxcgk+8HCkVZwjq1F7TW/HZad7TDhrj3B4PiJ4scgacegNjgU8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1658913817654681.6165303299891; Wed, 27 Jul 2022 02:23:37 -0700 (PDT) Received: from localhost ([::1]:44916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGdGR-0007AB-Ih for importer@patchew.org; Wed, 27 Jul 2022 05:23:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGdEr-000570-7N for qemu-devel@nongnu.org; Wed, 27 Jul 2022 05:21:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:50836) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGdEl-0002LC-5H for qemu-devel@nongnu.org; Wed, 27 Jul 2022 05:21:56 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-531-2dyczD-xNX6gCKG-XZ8uyg-1; Wed, 27 Jul 2022 05:21:45 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 842168057DF; Wed, 27 Jul 2022 09:21:45 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3773492C3B; Wed, 27 Jul 2022 09:21:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658913710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o5I0SevDO12E2oHsF17QadEpWSZOQGdfROrC/PH4sQQ=; b=COtd4ByHezwcpibUbRFJeOtG85m6u5h6uguvAXEEWNJcQkBmyPDQBo1G2hdIfcXWuTWSW6 U2DdJsnesrJ2gq18Q8YfzhpLiIye97pjM43ut4ng2qYYpRl9ZafwKxW1AdRltwQRfrwJay EzQ/ymX7+xxB8EzvIOyUsVOR+s8syMs= X-MC-Unique: 2dyczD-xNX6gCKG-XZ8uyg-1 From: Thomas Huth To: Michael Roth , Konstantin Kostiuk , qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , BALATON Zoltan , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 2/3] qga: Replace 'blacklist' and 'whitelist' in the guest agent sources Date: Wed, 27 Jul 2022 11:21:34 +0200 Message-Id: <20220727092135.302915-3-thuth@redhat.com> In-Reply-To: <20220727092135.302915-1-thuth@redhat.com> References: <20220727092135.302915-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658913819785100005 Content-Type: text/plain; charset="utf-8" Let's use better, more inclusive wording here. Signed-off-by: Thomas Huth Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Konstantin Kostiuk --- qga/qapi-schema.json | 4 +-- qga/guest-agent-core.h | 2 +- qga/commands-posix.c | 16 ++++++------ qga/commands-win32.c | 10 +++---- qga/main.c | 59 +++++++++++++++++++++--------------------- 5 files changed, 46 insertions(+), 45 deletions(-) diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json index 869399ea1a..026a56f76c 100644 --- a/qga/qapi-schema.json +++ b/qga/qapi-schema.json @@ -16,8 +16,8 @@ =20 { 'pragma': { 'doc-required': true } } =20 -# Whitelists to permit QAPI rule violations; think twice before you -# add to them! +# Lists with items allowed to permit QAPI rule violations; think twice +# before you add to them! { 'pragma': { # Types whose member names may use '_' 'member-name-exceptions': [ diff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h index 29cd50402f..b4e7c52c61 100644 --- a/qga/guest-agent-core.h +++ b/qga/guest-agent-core.h @@ -24,7 +24,7 @@ typedef struct GACommandState GACommandState; extern GAState *ga_state; extern QmpCommandList ga_commands; =20 -GList *ga_command_blacklist_init(GList *blacklist); +GList *ga_command_init_blockedrpcs(GList *blockedrpcs); void ga_command_state_init(GAState *s, GACommandState *cs); void ga_command_state_add(GACommandState *cs, void (*init)(void), diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 954efed01b..eea819cff0 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -3356,8 +3356,8 @@ qmp_guest_fstrim(bool has_minimum, int64_t minimum, E= rror **errp) } #endif =20 -/* add unsupported commands to the blacklist */ -GList *ga_command_blacklist_init(GList *blacklist) +/* add unsupported commands to the list of blocked RPCs */ +GList *ga_command_init_blockedrpcs(GList *blockedrpcs) { #if !defined(__linux__) { @@ -3370,13 +3370,13 @@ GList *ga_command_blacklist_init(GList *blacklist) char **p =3D (char **)list; =20 while (*p) { - blacklist =3D g_list_append(blacklist, g_strdup(*p++)); + blockedrpcs =3D g_list_append(blockedrpcs, g_strdup(*p++)); } } #endif =20 #if !defined(HAVE_GETIFADDRS) - blacklist =3D g_list_append(blacklist, + blockedrpcs =3D g_list_append(blockedrpcs, g_strdup("guest-network-get-interfaces")); #endif =20 @@ -3390,18 +3390,18 @@ GList *ga_command_blacklist_init(GList *blacklist) char **p =3D (char **)list; =20 while (*p) { - blacklist =3D g_list_append(blacklist, g_strdup(*p++)); + blockedrpcs =3D g_list_append(blockedrpcs, g_strdup(*p++)); } } #endif =20 #if !defined(CONFIG_FSTRIM) - blacklist =3D g_list_append(blacklist, g_strdup("guest-fstrim")); + blockedrpcs =3D g_list_append(blockedrpcs, g_strdup("guest-fstrim")); #endif =20 - blacklist =3D g_list_append(blacklist, g_strdup("guest-get-devices")); + blockedrpcs =3D g_list_append(blockedrpcs, g_strdup("guest-get-devices= ")); =20 - return blacklist; + return blockedrpcs; } =20 /* register init/cleanup routines for stateful command groups */ diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 7ed7664715..ec9f55b453 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -2005,8 +2005,8 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info= (Error **errp) return NULL; } =20 -/* add unsupported commands to the blacklist */ -GList *ga_command_blacklist_init(GList *blacklist) +/* add unsupported commands to the list of blocked RPCs */ +GList *ga_command_init_blockedrpcs(GList *blockedrpcs) { const char *list_unsupported[] =3D { "guest-suspend-hybrid", @@ -2017,7 +2017,7 @@ GList *ga_command_blacklist_init(GList *blacklist) char **p =3D (char **)list_unsupported; =20 while (*p) { - blacklist =3D g_list_append(blacklist, g_strdup(*p++)); + blockedrpcs =3D g_list_append(blockedrpcs, g_strdup(*p++)); } =20 if (!vss_init(true)) { @@ -2028,11 +2028,11 @@ GList *ga_command_blacklist_init(GList *blacklist) p =3D (char **)list; =20 while (*p) { - blacklist =3D g_list_append(blacklist, g_strdup(*p++)); + blockedrpcs =3D g_list_append(blockedrpcs, g_strdup(*p++)); } } =20 - return blacklist; + return blockedrpcs; } =20 /* register init/cleanup routines for stateful command groups */ diff --git a/qga/main.c b/qga/main.c index 74e5c9b10c..5a9d8252e0 100644 --- a/qga/main.c +++ b/qga/main.c @@ -87,7 +87,7 @@ struct GAState { #endif bool delimit_response; bool frozen; - GList *blacklist; + GList *blockedrpcs; char *state_filepath_isfrozen; struct { const char *log_filepath; @@ -107,7 +107,7 @@ struct GAState *ga_state; QmpCommandList ga_commands; =20 /* commands that are safe to issue while filesystems are frozen */ -static const char *ga_freeze_whitelist[] =3D { +static const char *ga_freeze_allowlist[] =3D { "guest-ping", "guest-info", "guest-sync", @@ -363,31 +363,31 @@ static gint ga_strcmp(gconstpointer str1, gconstpoint= er str2) } =20 /* disable commands that aren't safe for fsfreeze */ -static void ga_disable_non_whitelisted(const QmpCommand *cmd, void *opaque) +static void ga_disable_not_allowed(const QmpCommand *cmd, void *opaque) { - bool whitelisted =3D false; + bool allowed =3D false; int i =3D 0; const char *name =3D qmp_command_name(cmd); =20 - while (ga_freeze_whitelist[i] !=3D NULL) { - if (strcmp(name, ga_freeze_whitelist[i]) =3D=3D 0) { - whitelisted =3D true; + while (ga_freeze_allowlist[i] !=3D NULL) { + if (strcmp(name, ga_freeze_allowlist[i]) =3D=3D 0) { + allowed =3D true; } i++; } - if (!whitelisted) { + if (!allowed) { g_debug("disabling command: %s", name); qmp_disable_command(&ga_commands, name, "the agent is in frozen st= ate"); } } =20 -/* [re-]enable all commands, except those explicitly blacklisted by user */ -static void ga_enable_non_blacklisted(const QmpCommand *cmd, void *opaque) +/* [re-]enable all commands, except those explicitly blocked by user */ +static void ga_enable_non_blocked(const QmpCommand *cmd, void *opaque) { - GList *blacklist =3D opaque; + GList *blockedrpcs =3D opaque; const char *name =3D qmp_command_name(cmd); =20 - if (g_list_find_custom(blacklist, name, ga_strcmp) =3D=3D NULL && + if (g_list_find_custom(blockedrpcs, name, ga_strcmp) =3D=3D NULL && !qmp_command_is_enabled(cmd)) { g_debug("enabling command: %s", name); qmp_enable_command(&ga_commands, name); @@ -426,8 +426,8 @@ void ga_set_frozen(GAState *s) if (ga_is_frozen(s)) { return; } - /* disable all non-whitelisted (for frozen state) commands */ - qmp_for_each_command(&ga_commands, ga_disable_non_whitelisted, NULL); + /* disable all forbidden (for frozen state) commands */ + qmp_for_each_command(&ga_commands, ga_disable_not_allowed, NULL); g_warning("disabling logging due to filesystem freeze"); ga_disable_logging(s); s->frozen =3D true; @@ -465,8 +465,8 @@ void ga_unset_frozen(GAState *s) s->deferred_options.pid_filepath =3D NULL; } =20 - /* enable all disabled, non-blacklisted commands */ - qmp_for_each_command(&ga_commands, ga_enable_non_blacklisted, s->black= list); + /* enable all disabled, non-blocked commands */ + qmp_for_each_command(&ga_commands, ga_enable_non_blocked, s->blockedrp= cs); s->frozen =3D false; if (!ga_delete_file(s->state_filepath_isfrozen)) { g_warning("unable to delete %s, fsfreeze may not function properly= ", @@ -896,7 +896,8 @@ int64_t ga_get_fd_handle(GAState *s, Error **errp) int64_t handle; =20 g_assert(s->pstate_filepath); - /* we blacklist commands and avoid operations that potentially require + /* + * We block commands and avoid operations that potentially require * writing to disk when we're in a frozen state. this includes opening * new files, so we should never get here in that situation */ @@ -950,8 +951,8 @@ struct GAConfig { #ifdef _WIN32 const char *service; #endif - gchar *bliststr; /* blacklist may point to this string */ - GList *blacklist; + gchar *bliststr; /* blockedrpcs may point to this string */ + GList *blockedrpcs; int daemonize; GLogLevelFlags log_level; int dumpconf; @@ -1019,7 +1020,7 @@ static void config_load(GAConfig *config) if (g_key_file_has_key(keyfile, "general", blockrpcs_key, NULL)) { config->bliststr =3D g_key_file_get_string(keyfile, "general", blockrpcs_key, &gerr= ); - config->blacklist =3D g_list_concat(config->blacklist, + config->blockedrpcs =3D g_list_concat(config->blockedrpcs, split_list(config->bliststr, ","= )); } =20 @@ -1079,7 +1080,7 @@ static void config_dump(GAConfig *config) config->log_level =3D=3D G_LOG_LEVEL_MASK); g_key_file_set_boolean(keyfile, "general", "retry-path", config->retry_path); - tmp =3D list_join(config->blacklist, ','); + tmp =3D list_join(config->blockedrpcs, ','); g_key_file_set_string(keyfile, "general", "block-rpcs", tmp); g_free(tmp); =20 @@ -1171,8 +1172,8 @@ static void config_parse(GAConfig *config, int argc, = char **argv) qmp_for_each_command(&ga_commands, ga_print_cmd, NULL); exit(EXIT_SUCCESS); } - config->blacklist =3D g_list_concat(config->blacklist, - split_list(optarg, ",")); + config->blockedrpcs =3D g_list_concat(config->blockedrpcs, + split_list(optarg, ",")); break; } #ifdef _WIN32 @@ -1226,7 +1227,7 @@ static void config_free(GAConfig *config) #ifdef CONFIG_FSFREEZE g_free(config->fsfreeze_hook); #endif - g_list_free_full(config->blacklist, g_free); + g_list_free_full(config->blockedrpcs, g_free); g_free(config); } =20 @@ -1310,7 +1311,7 @@ static GAState *initialize_agent(GAConfig *config, in= t socket_activation) s->deferred_options.log_filepath =3D config->log_filepath; } ga_disable_logging(s); - qmp_for_each_command(&ga_commands, ga_disable_non_whitelisted, NUL= L); + qmp_for_each_command(&ga_commands, ga_disable_not_allowed, NULL); } else { if (config->daemonize) { become_daemon(config->pid_filepath); @@ -1334,10 +1335,10 @@ static GAState *initialize_agent(GAConfig *config, = int socket_activation) return NULL; } =20 - config->blacklist =3D ga_command_blacklist_init(config->blacklist); - if (config->blacklist) { - GList *l =3D config->blacklist; - s->blacklist =3D config->blacklist; + config->blockedrpcs =3D ga_command_init_blockedrpcs(config->blockedrpc= s); + if (config->blockedrpcs) { + GList *l =3D config->blockedrpcs; + s->blockedrpcs =3D config->blockedrpcs; do { g_debug("disabling command: %s", (char *)l->data); qmp_disable_command(&ga_commands, l->data, NULL); --=20 2.31.1 From nobody Thu May 16 23:20:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1658914051; cv=none; d=zohomail.com; s=zohoarc; b=N7dzT/XwAWThuNY8PHsYbFhj3QnLT65J3c1AJko/crnJZ+Z02vTSOP7aY7tmWHMAAWimOBuXhrDU8lNfRc9SzWLok5+n+gJIQMz2JXwGTtQWa8dC09Odb0XWVJhEnET8A/EUe3J+YhYPdCv9uTofSUjrkH5zy/kpi/nDgygrk2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658914051; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PpVecOWIK7EPtinVFSnYW1ad9CIw7kruWyv0MiDo6Qo=; b=R1rMFDNLNTan44gWpy0xQQS/fju9+owmPGCczo5Rd6wjG90PQdv5lOy6nmYjlmomrTBvnCI95mdpKqnOZaKu9Mm0Y58EB7VPFIXyLq4BSi7Uy0OjZFNJS0PqcjOsKRnwm3gC+DyPWtfd4l5f2KZNiXhBYX/+cdudmiWoSdhWcjY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1658914051492381.75192297271735; Wed, 27 Jul 2022 02:27:31 -0700 (PDT) Received: from localhost ([::1]:50674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGdKE-0002nJ-DE for importer@patchew.org; Wed, 27 Jul 2022 05:27:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGdEs-00057R-VV for qemu-devel@nongnu.org; Wed, 27 Jul 2022 05:21:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54004) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGdEo-0002LK-52 for qemu-devel@nongnu.org; Wed, 27 Jul 2022 05:21:57 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-342-xXtXs-G-M5KwMLzbubVdNQ-1; Wed, 27 Jul 2022 05:21:47 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5F59E2804076; Wed, 27 Jul 2022 09:21:47 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id D912F492C3B; Wed, 27 Jul 2022 09:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658913711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PpVecOWIK7EPtinVFSnYW1ad9CIw7kruWyv0MiDo6Qo=; b=OrDGiqGCGV15sjyZVXm3L3pXqURhpzJuHCB/iNu3dYbS/RTMOES0A5RO9OJsIp/+TDw9fg 3RS2QttjJAalSng8ZZ7T7V1XbPV8ZXU566rEtGABn06NT0hs8Bn0m40LYOXEvo4Umgk+hJ rhXClDkbZNFctWUbACUvT50ZLxURElw= X-MC-Unique: xXtXs-G-M5KwMLzbubVdNQ-1 From: Thomas Huth To: Michael Roth , Konstantin Kostiuk , qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , BALATON Zoltan , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 3/3] tests/unit/test-qga: Replace the word 'blacklist' in the guest agent unit test Date: Wed, 27 Jul 2022 11:21:35 +0200 Message-Id: <20220727092135.302915-4-thuth@redhat.com> In-Reply-To: <20220727092135.302915-1-thuth@redhat.com> References: <20220727092135.302915-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658914053141100001 Content-Type: text/plain; charset="utf-8" Let's use better, more inclusive wording here. Signed-off-by: Thomas Huth Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Konstantin Kostiuk --- tests/unit/test-qga.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c index c398866f46..80bb6b0866 100644 --- a/tests/unit/test-qga.c +++ b/tests/unit/test-qga.c @@ -629,7 +629,7 @@ static void test_qga_get_time(gconstpointer fix) g_assert_cmpint(time, >, 0); } =20 -static void test_qga_blacklist(gconstpointer data) +static void test_qga_blockedrpcs(gconstpointer data) { TestFixture fix; QDict *ret, *error; @@ -637,7 +637,7 @@ static void test_qga_blacklist(gconstpointer data) =20 fixture_setup(&fix, "-b guest-ping,guest-get-time", NULL); =20 - /* check blacklist */ + /* check blocked RPCs */ ret =3D qmp_fd(fix.fd, "{'execute': 'guest-ping'}"); g_assert_nonnull(ret); error =3D qdict_get_qdict(ret, "error"); @@ -968,7 +968,7 @@ int main(int argc, char **argv) g_test_add_data_func("/qga/fsfreeze-status", &fix, test_qga_fsfreeze_status); =20 - g_test_add_data_func("/qga/blacklist", NULL, test_qga_blacklist); + g_test_add_data_func("/qga/blockedrpcs", NULL, test_qga_blockedrpcs); g_test_add_data_func("/qga/config", NULL, test_qga_config); g_test_add_data_func("/qga/guest-exec", &fix, test_qga_guest_exec); g_test_add_data_func("/qga/guest-exec-invalid", &fix, --=20 2.31.1