Skip to content

fix: keep the VNC display across a running-origin restore; refuse the CNI case up front - #37

Merged
CMGS merged 3 commits into
masterfrom
fix/restore-keeps-vnc-display
Sep 2, 2026
Merged

fix: keep the VNC display across a running-origin restore; refuse the CNI case up front#37
CMGS merged 3 commits into
masterfrom
fix/restore-keeps-vnc-display

Conversation

@CMGS

@CMGS CMGS commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #36, found by running it against a real sequoia:15 guest on bare metal.

With --net user, vm restore --force on a running VM relaunched qemu without -vnc: the stop tail had cleared VNCDisp before launch read it, so the display was lost after every running-origin restore, while the pre-#36 binary kept it. The display is the VM's persisted configuration; only the password and the proxy are launch-scoped, and a non-CNI VM has no proxy to stop.

  • restore's running-origin branch keeps VNCDisp: terminate, zero PID, save the record, apply, relaunch.
  • a running origin whose display is password-gated is refused before anything is touched: the relaunch cannot carry the never-persisted password, and before fix: restore --force relaunches under the launch-scoped VNC contract #36 the same case failed inside launch after the disks were already reverted (CNI) or came back unauthenticated (user/tap/bridge). The record carries a non-secret vnc_password_set bit, written at launch and cleared at stop; Netns stays as the fallback for records written before the bit existed. The error names the working sequence (stop, restore, start --vnc N --vnc-password).
  • saveStopped is gone; Stop keeps its own tail. launch still stops a stale proxy before every relaunch.
  • Linux test TestRestoreRefusesRunningPasswordedVNC drives the refusal against the fake qemu.

Hardware evidence (.79, sequoia:15): pre-#36 binary answers RFB on the display after restore --force in user mode; the #36 build does not (qemu alive, no -vnc); this branch answers RFB after restore in user mode, refuses the running CNI origin with the display untouched, and stop/restore/start --vnc --vnc-password relaunches exactly one proxy.

Gates: make lint 0 issues both GOOS, make fmt-check, asl ./... both GOOS, go test -race ./...; the Linux-gated test run on the Linux host.

CMGS added 3 commits September 2, 2026 19:57
… CNI case up front

The .79 round showed a user-mode VM losing VNC after `restore --force`:
the relaunch read the display the stop tail had just cleared. The
display is the VM's persisted configuration; only the password and the
proxy are launch-scoped, and a non-CNI VM has no proxy to stop. A CNI VM
with VNC cannot relaunch without its password (launch already refused
after the disks were reverted), so restore now refuses it before
touching anything.

(cherry picked from commit 0617aca)
…play

The guard keyed on CNI, but a user, tap or bridge VM can be started with
--vnc-password too, and the password is never persisted: its relaunch
came back unauthenticated. The record now carries a non-secret
vnc_password_set bit written at launch and cleared at stop, and restore
refuses any running origin whose display is password-gated. Linux test
drives the refusal against the fake qemu and checks it never terminates.
A start that daemonized qemu and then failed to read the pidfile or save
the record left a live, later-adopted qemu with the bit still false, so a
restore could relaunch it unauthenticated. The bit is now written with
the record before the spawn; a save failure aborts the launch.
@CMGS
CMGS merged commit 0cee700 into master Sep 2, 2026
3 checks passed
@CMGS
CMGS deleted the fix/restore-keeps-vnc-display branch September 2, 2026 14:06
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