mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tools/xenstored: allow @releaseDomain watch for all domains
Currently the @releaseDomain watch is allowed for dom0 only. This is problematic for guests which want to give other domains access to Xenstore entries, as they have no simple way to tell when such a domain is stopped. Allow @releaseDomain to be usable by all domains as the default. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Jason Andryuk <jason.andryuk@amd.com> Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
This commit is contained in:
1 parent
42aeed3b53
commit
258263a4fb
1 file changed
+20
-6
+20
-6
@@ -2279,19 +2279,19 @@ struct connection *get_connection_by_id(unsigned int conn_id)
|
||||
}
|
||||
|
||||
/* We create initial nodes manually. */
|
||||
static void manual_node(const char *name, const char *child)
|
||||
static void manual_node_perms(const char *name, const char *child,
|
||||
struct xs_permissions *perms,
|
||||
unsigned int n_perms)
|
||||
{
|
||||
struct node *node;
|
||||
struct xs_permissions perms = { .id = priv_domid,
|
||||
.perms = XS_PERM_NONE };
|
||||
|
||||
node = talloc_zero(NULL, struct node);
|
||||
if (!node)
|
||||
barf_perror("Could not allocate initial node %s", name);
|
||||
|
||||
node->name = name;
|
||||
node->perms = &perms;
|
||||
node->hdr.num_perms = 1;
|
||||
node->perms = perms;
|
||||
node->hdr.num_perms = n_perms;
|
||||
node->children = (char *)child;
|
||||
if (child)
|
||||
node->hdr.childlen = strlen(child) + 1;
|
||||
@@ -2301,6 +2301,14 @@ static void manual_node(const char *name, const char *child)
|
||||
talloc_free(node);
|
||||
}
|
||||
|
||||
static void manual_node(const char *name, const char *child)
|
||||
{
|
||||
struct xs_permissions perms = { .id = priv_domid,
|
||||
.perms = XS_PERM_NONE };
|
||||
|
||||
manual_node_perms(name, child, &perms, 1);
|
||||
}
|
||||
|
||||
static unsigned int hash_from_key_fn(const void *k)
|
||||
{
|
||||
const char *str = k;
|
||||
@@ -2320,6 +2328,11 @@ static int keys_equal_fn(const void *key1, const void *key2)
|
||||
|
||||
void setup_structure(bool live_update)
|
||||
{
|
||||
struct xs_permissions perms[] = {
|
||||
{ .id = priv_domid, .perms = XS_PERM_NONE },
|
||||
{ .id = DOMID_ANY, .perms = XS_PERM_READ },
|
||||
};
|
||||
|
||||
nodes = create_hashtable(NULL, "nodes", hash_from_key_fn, keys_equal_fn,
|
||||
HASHTABLE_FREE_KEY | HASHTABLE_FREE_VALUE);
|
||||
if (!nodes)
|
||||
@@ -2331,7 +2344,8 @@ void setup_structure(bool live_update)
|
||||
manual_node("/", "tool");
|
||||
manual_node("/tool", "xenstored");
|
||||
manual_node("/tool/xenstored", NULL);
|
||||
manual_node("@releaseDomain", NULL);
|
||||
manual_node_perms("@releaseDomain", NULL,
|
||||
perms, ARRAY_SIZE(perms));
|
||||
manual_node("@introduceDomain", NULL);
|
||||
domain_nbentry_fix(priv_domid, 5);
|
||||
}
|
||||
|
||||