Skip to contentSkip to conversation

Potential bug in special watch event firing

cxenstored Raphael Ning 2 participants 3 messages Apr 26, 2022 – Apr 27, 2022

lore
Share & tools
lore
#0 lore raw

While reading C xenstored code, I noticed that it may send special events like @releaseDomain to (privileged) clients that only watch the root node (/). That's probably not the intended behaviour.

For example, when firing @releaseDomain, fire_watches() is called with exact == false:

https://github.com/xen-project/xen/blob/2419a159fb943c24a6f2439604b9fdb1478fcd08/tools/xenstore/xenstored_domain.c#L234

As a result, it will check whether @releaseDomain is a child of the path being watched:

https://github.com/xen-project/xen/blob/2419a159fb943c24a6f2439604b9fdb1478fcd08/tools/xenstore/xenstored_watch.c#L195

And when the parent path is /, is_child() unconditionally returns true:

https://github.com/xen-project/xen/blob/2419a159fb943c24a6f2439604b9fdb1478fcd08/tools/xenstore/xenstored_watch.c#L66

The xenstore documentation is not clear about whether @<wspecial> should be considered children of /. But I find it counterintuitive that clients may be notified about a special event without explicitly subscribing to it. Is it a bug?

Thanks,

Raphael

#1 lore raw

Hi Raphael,

Quoted 8 lines · Raphael Ning

While reading C xenstored code, I noticed that it may send special events like @releaseDomain to (privileged) clients that only watch the root node (/). That's probably not the intended behaviour.

For example, when firing @releaseDomain, fire_watches() is called with exact == false:

https://github.com/xen-project/xen/blob/2419a159fb943c24a6f2439604b9fdb1478fcd08/tools/xenstore/xenstored_domain.c#L234

As a result, it will check whether @releaseDomain is a child of the path being watched:

Quoted 7 lines

https://github.com/xen-project/xen/blob/2419a159fb943c24a6f2439604b9fdb1478fcd08/tools/xenstore/xenstored_watch.c#L195

And when the parent path is /, is_child() unconditionally returns true:

https://github.com/xen-project/xen/blob/2419a159fb943c24a6f2439604b9fdb1478fcd08/tools/xenstore/xenstored_watch.c#L66

The xenstore documentation is not clear about whether @<wspecial> should be considered children of /. But I find it counterintuitive that clients may be notified about a special event without explicitly subscribing to it. Is it a bug?

I agree this is a bug.

Juergen

#2 lore raw

Hi Juergen,

Quoted 4 lines · Juergen Gross

[...]

Quoted 1 line

The xenstore documentation is not clear about whether @<wspecial> should be considered children of /. But I find it counterintuitive that clients may be notified about a special event without explicitly subscribing to it. Is it a bug?

I agree this is a bug.

Thanks for confirming that. I can send a patch to fix it, but it probably won't happen until later next week. If anyone else can get it done sooner, please feel free to do so.

Raphael