tools/xenstored: allow domU to get own features

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 <jgross@suse.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
This commit is contained in:
Juergen Gross authored and Jan Beulich committed 2026-04-21 12:06:09 +02:00
1 parent edb657887a
commit cb8972017c
3 files changed
+17 -11

No files matched your search

+5 -4
View File
@@ -430,13 +430,14 @@ SET_FEATURE <domid>|<value>|
to set a bit for a feature not being supported by the running
Xenstore will be denied. Providing no <domid> with the
GET_FEATURE command will return the features which are supported
by Xenstore.
by Xenstore for the domain issuing the command.
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.
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.
GET_QUOTA [[<domid>|]<quota>|] <value>|
SET_QUOTA [<domid>|]<quota>|<value>|
+1 -2
View File
@@ -2031,8 +2031,7 @@ static struct {
{ "SET_TARGET", do_set_target, XS_FLAG_PRIV },
[XS_RESET_WATCHES] = { "RESET_WATCHES", do_reset_watches },
[XS_DIRECTORY_PART] = { "DIRECTORY_PART", send_directory_part },
[XS_GET_FEATURE] =
{ "GET_FEATURE", do_get_feature, XS_FLAG_PRIV },
[XS_GET_FEATURE] = { "GET_FEATURE", do_get_feature },
[XS_SET_FEATURE] =
{ "SET_FEATURE", do_set_feature, XS_FLAG_PRIV },
[XS_GET_QUOTA] =
+11 -5
View File
@@ -1323,10 +1323,17 @@ int do_get_feature(const void *ctx, struct connection *conn,
char *result;
n_args = get_strings(in, vec, ARRAY_SIZE(vec));
if (n_args > 1)
return EINVAL;
if (n_args == 1) {
if (!n_args) {
features = conn->domain ? conn->domain->features
: XENSTORE_FEATURES;
} else {
if (domain_is_unprivileged(conn))
return EACCES;
if (n_args > 1)
return EINVAL;
domid = parse_domid(vec[0]);
if (errno)
return errno;
@@ -1334,8 +1341,7 @@ int do_get_feature(const void *ctx, struct connection *conn,
if (!domain)
return ENOENT;
features = domain->features;
} else
features = XENSTORE_FEATURES;
}
result = talloc_asprintf(ctx, "%u", features);
if (!result)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.