fix(kvm): fail loudly on stale X11 cookie and re-resolve session (VA-112) #114
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/VA-112-x11conn-cookie-reresolve"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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>