fix(kvm): fail loudly on stale X11 cookie and re-resolve session (VA-112) #114

Merged
Claude-Run merged 1 commit from fix/VA-112-x11conn-cookie-reresolve into main 2026-07-04 18:50:39 +02:00
Member

After a display-manager restart the VA-107 explicit-addressing X11 path could send an empty authorization to the rotated X server, which rejects every connection with "Authorization required, but no authorization protocol specified". The capture loop then re-hit and re-logged that on every frame. The empty cookie was sent whenever the resolved SessionAddr had no Xauthority, or its Xauthority held no entry matching the (possibly changed) display number.

x11conn::connect_addr no longer falls back to an empty cookie. A missing authority file or a display with no matching cookie now returns a distinct KvmError::NotAvailable that names the missing/mismatched cookie, and the connect setup rejection ("Authorization required") is treated the same way, so a dead cookie is never retried silently.

Added an out-of-band re-resolve request to session_ctx (a coalescing tokio Notify): the X11 path raises it whenever its cached addressing proves stale at connect time, and the logind supervisor now selects on it alongside its D-Bus signal streams (debounced), so a display-manager restart that logind surfaced only as a same-id session churn still triggers a fresh active_session::resolve rather than pinning the stale cookie.

Rate-limited the desktop capture-failure log so a persistent backend error emits at most one line per five seconds (folding in a suppressed count) instead of ~30 lines/sec at the frame rate.

Hardened and covered cookie_from_bytes for the post-DM-restart greeter case: a display-number change from :0 to :1 selects the fresh :1 entry, and a FamilyWild greeter cookie matches whatever display the server came up on.

#VA-112

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

After a display-manager restart the VA-107 explicit-addressing X11 path could send an empty authorization to the rotated X server, which rejects every connection with "Authorization required, but no authorization protocol specified". The capture loop then re-hit and re-logged that on every frame. The empty cookie was sent whenever the resolved SessionAddr had no Xauthority, or its Xauthority held no entry matching the (possibly changed) display number. x11conn::connect_addr no longer falls back to an empty cookie. A missing authority file or a display with no matching cookie now returns a distinct KvmError::NotAvailable that names the missing/mismatched cookie, and the connect setup rejection ("Authorization required") is treated the same way, so a dead cookie is never retried silently. Added an out-of-band re-resolve request to session_ctx (a coalescing tokio Notify): the X11 path raises it whenever its cached addressing proves stale at connect time, and the logind supervisor now selects on it alongside its D-Bus signal streams (debounced), so a display-manager restart that logind surfaced only as a same-id session churn still triggers a fresh active_session::resolve rather than pinning the stale cookie. Rate-limited the desktop capture-failure log so a persistent backend error emits at most one line per five seconds (folding in a suppressed count) instead of ~30 lines/sec at the frame rate. Hardened and covered cookie_from_bytes for the post-DM-restart greeter case: a display-number change from :0 to :1 selects the fresh :1 entry, and a FamilyWild greeter cookie matches whatever display the server came up on. #VA-112 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fix(kvm): fail loudly on stale X11 cookie and re-resolve session (VA-112)
All checks were successful
Check / fmt + clippy + tests (pull_request) Successful in 5m42s
Create release / Create release from merged PR (pull_request) Has been skipped
1cdebd392d
After a display-manager restart the VA-107 explicit-addressing X11 path could send an empty authorization to the rotated X server, which rejects every connection with "Authorization required, but no authorization protocol specified". The capture loop then re-hit and re-logged that on every frame. The empty cookie was sent whenever the resolved SessionAddr had no Xauthority, or its Xauthority held no entry matching the (possibly changed) display number.

x11conn::connect_addr no longer falls back to an empty cookie. A missing authority file or a display with no matching cookie now returns a distinct KvmError::NotAvailable that names the missing/mismatched cookie, and the connect setup rejection ("Authorization required") is treated the same way, so a dead cookie is never retried silently.

Added an out-of-band re-resolve request to session_ctx (a coalescing tokio Notify): the X11 path raises it whenever its cached addressing proves stale at connect time, and the logind supervisor now selects on it alongside its D-Bus signal streams (debounced), so a display-manager restart that logind surfaced only as a same-id session churn still triggers a fresh active_session::resolve rather than pinning the stale cookie.

Rate-limited the desktop capture-failure log so a persistent backend error emits at most one line per five seconds (folding in a suppressed count) instead of ~30 lines/sec at the frame rate.

Hardened and covered cookie_from_bytes for the post-DM-restart greeter case: a display-number change from :0 to :1 selects the fresh :1 entry, and a FamilyWild greeter cookie matches whatever display the server came up on.

#VA-112

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Run deleted branch fix/VA-112-x11conn-cookie-reresolve 2026-07-04 18:50:39 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/vervain-agent!114
No description provided.