You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a76a586
Browse filesBrowse the repository at this point in the historyBrowse files
cli: keep a cold run's console when OpenVMM exits before the peer check
A cold `nvx-rs run` on Linux could exit with OpenVMM's status, 0, and
print none of OpenVMM's console output, with no error. The CLI test
`one_shot_runs_exit_with_the_workload_or_openvmm_status` failed that
way in CI run 43156460151 (job 130977435086, on #1501), and once in a
local run of SL6.2b's on nvx-mshv-test.
The run connects to the boot console on which OpenVMM listens, then
checks the socket's original peer: its `SO_PEERCRED` PID must be
OpenVMM's, and its `SO_PEERPIDFD` pidfd must not report an exit. The
fake OpenVMM accepts the connection, writes its line and exits at
once. When it exits between the run's `connect` and that check, the
check refuses the peer as exited, and `connect_before_exit` yields to
OpenVMM's exit status, dropping the connection with the output already
queued in it. A real OpenVMM, too, writes its output and exits without
waiting for the run to read it, so a run that stalls at that point on
a loaded host loses its output silently.
The console now connects with `connect_child_endpoint`, which checks
the peer as `connect_endpoint` does, but accepts an original peer that
has exited and has not been reaped, and still refuses a reaped one.
That is safe because the run's own unreaped child keeps its PID, which
no other process can reuse until the run reaps it, so a peer that
holds the child's PID is the child. `PidFd::holds_its_id` tells an
unreaped process from a reaped one with signal 0 through the pidfd,
which fails with `ESRCH` only once the process is reaped. Every other
connection, the control sessions and the restore-ready endpoint, still
refuses an exited peer. Windows is unchanged: its `connect_endpoint`
checks only the pipe's server process ID.
Tests: `a_child_endpoint_accepts_its_exited_child_until_the_child_is_reaped`
connects to a listener whose creator, the test's child, has exited
and is not reaped: `connect_endpoint` refuses it,
`connect_child_endpoint` accepts it and reads through it, and both
refuse it once the test has reaped the creator. It shares the Python
launcher of `a_transferred_listener_cannot_authenticate_its_exited_creator`,
which now runs through the same helper and still reaps the creator
first.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments