From nobody Mon Mar 23 21:43:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=quarantine dis=quarantine) header.from=suse.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1773388118420405.64002279156625; Fri, 13 Mar 2026 00:48:38 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1253347.1549622 (Exim 4.92) (envelope-from ) id 1w0xFa-0003ht-NG; Fri, 13 Mar 2026 07:48:02 +0000 Received: by outflank-mailman (output) from mailman id 1253347.1549622; Fri, 13 Mar 2026 07:48:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0xFa-0003hm-KQ; Fri, 13 Mar 2026 07:48:02 +0000 Received: by outflank-mailman (input) for mailman id 1253347; Fri, 13 Mar 2026 07:48:01 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0xFZ-0003h2-U2 for xen-devel@lists.xenproject.org; Fri, 13 Mar 2026 07:48:01 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f4c34d4d-1eb0-11f1-9ccf-f158ae23cfc8; Fri, 13 Mar 2026 08:47:59 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0D0BC4E3F0; Fri, 13 Mar 2026 07:47:59 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CA916403F6; Fri, 13 Mar 2026 07:47:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id KjFkMC7Bs2mpGAAAD6G6ig (envelope-from ); Fri, 13 Mar 2026 07:47:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: f4c34d4d-1eb0-11f1-9ccf-f158ae23cfc8 Authentication-Results: smtp-out1.suse.de; none From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini Subject: [PATCH 1/8] tools/xenstored: allow domU to get own features Date: Fri, 13 Mar 2026 08:47:44 +0100 Message-ID: <20260313074751.2904215-2-jgross@suse.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260313074751.2904215-1-jgross@suse.com> References: <20260313074751.2904215-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 0D0BC4E3F0 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Score: -4.00 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-ZM-MESSAGEID: 1773388120981154100 Content-Type: text/plain; charset="utf-8" Expand the XS_GET_FEATURE command to allow an unprivileged domain to read its own available features. While this information is available via the related field in the shared page used for communication with Xenstore, user land components of the domU would need special support in the related kernel driver to obtain that data. With supporting the XS_GET_FEATURE for that purpose, only an up to date libxenstore is needed. Signed-off-by: Juergen Gross --- docs/misc/xenstore.txt | 9 +++++---- tools/xenstored/core.c | 3 +-- tools/xenstored/domain.c | 16 +++++++++++----- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/docs/misc/xenstore.txt b/docs/misc/xenstore.txt index 4eccbc2f7f..8a2c19d116 100644 --- a/docs/misc/xenstore.txt +++ b/docs/misc/xenstore.txt @@ -427,13 +427,14 @@ SET_FEATURE || to set a bit for a feature not being supported by the running Xenstore will be denied. Providing no with the GET_FEATURE command will return the features which are supported - by Xenstore. + by Xenstore for the domain issuing the command. =20 SET_FEATURE for a domain will be rejected after the INTRODUCE - command for this domain has been sent to xenstored. + command for this domain has been sent to xenstored. This has the + effect that dom0 will always have all supported features enabled. =20 - xenstored prevents the use of GET_FEATURE and SET_FEATURE other - than by dom0. + xenstored prevents the use of GET_FEATURE with a domid specified + and SET_FEATURE other than by dom0. =20 GET_QUOTA [[|]|] | SET_QUOTA [|]|| diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c index e283d47184..09f1390f14 100644 --- a/tools/xenstored/core.c +++ b/tools/xenstored/core.c @@ -2030,8 +2030,7 @@ static struct { { "SET_TARGET", do_set_target, XS_FLAG_PRIV }, [XS_RESET_WATCHES] =3D { "RESET_WATCHES", do_reset_watches }, [XS_DIRECTORY_PART] =3D { "DIRECTORY_PART", send_directory_part }, - [XS_GET_FEATURE] =3D - { "GET_FEATURE", do_get_feature, XS_FLAG_PRIV }, + [XS_GET_FEATURE] =3D { "GET_FEATURE", do_get_feature }, [XS_SET_FEATURE] =3D { "SET_FEATURE", do_set_feature, XS_FLAG_PRIV }, [XS_GET_QUOTA] =3D diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c index c0bc8a3eb7..ebeced3228 100644 --- a/tools/xenstored/domain.c +++ b/tools/xenstored/domain.c @@ -1293,17 +1293,23 @@ int do_get_feature(const void *ctx, struct connecti= on *conn, char *result; =20 n_args =3D get_strings(in, vec, ARRAY_SIZE(vec)); - if (n_args > 1) - return EINVAL; =20 - if (n_args =3D=3D 1) { + if (!n_args) { + features =3D conn->domain ? conn->domain->features + : XENSTORE_FEATURES; + } else { + if (domain_is_unprivileged(conn)) + return EACCES; + + if (n_args > 1) + return EINVAL; + domid =3D atoi(vec[0]); domain =3D find_or_alloc_existing_domain(domid); if (!domain) return ENOENT; features =3D domain->features; - } else - features =3D XENSTORE_FEATURES; + } =20 result =3D talloc_asprintf(ctx, "%u", features); if (!result) --=20 2.53.0