diff mbox series

[v2] tools/xenstore: don't let special watches be children of /

Message ID 20220502100722.17250-1-jgross@suse.com (mailing list archive)
State New, archived
Headers show
Series [v2] tools/xenstore: don't let special watches be children of / | expand

Commit Message

Jürgen Groß May 2, 2022, 10:07 a.m. UTC
When firing special watches (e.g. "@releaseDomain"), they will be
regarded to be valid children of the "/" node. So a domain having
registered a watch for "/" and having the privilege to receive
the special watches will receive those special watch events for the
registered "/" watch.

Fix that by calling the related fire_watches() with the "exact"
parameter set to true, causing a mismatch for the "/" node.

Reported-by: Raphael Ning <raphning@amazon.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Raphael Ning <raphning@amazon.com>
---
V2:
- use Rapahael's amazon mail address
---
 tools/xenstore/xenstored_domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Julien Grall May 5, 2022, 10:59 a.m. UTC | #1
Hi Juergen,

On 02/05/2022 11:07, Juergen Gross wrote:
> When firing special watches (e.g. "@releaseDomain"), they will be
> regarded to be valid children of the "/" node. So a domain having
> registered a watch for "/" and having the privilege to receive
> the special watches will receive those special watch events for the
> registered "/" watch.
> 
> Fix that by calling the related fire_watches() with the "exact"
> parameter set to true, causing a mismatch for the "/" node.
> 
> Reported-by: Raphael Ning <raphning@amazon.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Reviewed-by: Raphael Ning <raphning@amazon.com>

Reviewed-by: Julien Grall <jgrall@amazon.com>

And commited it.

Cheers,
diff mbox series

Patch

diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index ae065fcbee..80ba1d627b 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -231,7 +231,7 @@  static int destroy_domain(void *_domain)
 			unmap_interface(domain->interface);
 	}
 
-	fire_watches(NULL, domain, "@releaseDomain", NULL, false, NULL);
+	fire_watches(NULL, domain, "@releaseDomain", NULL, true, NULL);
 
 	wrl_domain_destroy(domain);
 
@@ -282,7 +282,7 @@  void check_domains(void)
 	}
 
 	if (notify)
-		fire_watches(NULL, NULL, "@releaseDomain", NULL, false, NULL);
+		fire_watches(NULL, NULL, "@releaseDomain", NULL, true, NULL);
 }
 
 /* We scan all domains rather than use the information given here. */
@@ -495,7 +495,7 @@  static struct domain *introduce_domain(const void *ctx,
 
 		if (!is_master_domain && !restore)
 			fire_watches(NULL, ctx, "@introduceDomain", NULL,
-				     false, NULL);
+				     true, NULL);
 	} else {
 		/* Use XS_INTRODUCE for recreating the xenbus event-channel. */
 		if (domain->port)