Skip to content

fix(xenstore): encode UNWATCH path before token - #480

Open
agocharbhatia wants to merge 1 commit into
edera-dev:mainfrom
agocharbhatia:fix/unwatch-payload-order
Open

agocharbhatia wants to merge 1 commit into
edera-dev:mainfrom
agocharbhatia:fix/unwatch-payload-order

Conversation

@agocharbhatia

Copy link
Copy Markdown

Problem

The Xenstore protocol identifies a watch by path, then token, with each field NUL terminated. WATCH registration already uses that order, but the asynchronous UNWATCH branch sends the token first. Dropping a bound watch therefore sends a different unregister identity.

Change

Encode UNWATCH as path followed by token. Add a regression using the actual socket reader, request processor and client watch API through a Unix socket pair. It registers two watches, drops one, and checks that removal repeats the original registration payload while the other watch and connection remain usable.

The fixture also checks request IDs, transaction context, interleaved watch events and out-of-order read replies. Cleanup is bounded and shuts down the reader on failure.

Verification

On base c6982138ce0bbdc5fddfc76a10efb4776682563e, the identical test fails at the payload-identity assertion. It passes with this patch.

  • cargo test --locked -p krata-xenstore --lib bus::tests::unwatch_preserves_watch_identity -- --exact --nocapture
  • cargo test --locked -p krata-xenstore
  • cargo fmt --all -- --check

Run natively on macOS arm64 with Rust 1.97.1. The peer supplies synthetic protocol replies; this does not test a real Xenstore server or Linux/Xen integration.

Protocol reference: https://xenbits.xen.org/docs/unstable/misc/xenstore.txt

@agocharbhatia
agocharbhatia force-pushed the fix/unwatch-payload-order branch from 13f7c98 to 990aebc Compare November 2, 2026 00:56

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant