|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 1/8] 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@xxxxxxxx>
---
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 <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>|
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] = { "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] =
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 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 = atoi(vec[0]);
domain = find_or_alloc_existing_domain(domid);
if (!domain)
return ENOENT;
features = domain->features;
- } else
- features = XENSTORE_FEATURES;
+ }
result = talloc_asprintf(ctx, "%u", features);
if (!result)
--
2.53.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |