Skip to content

Never signal a macOS guest by a stored PID alone - #612

Draft
yummybomb wants to merge 1 commit into
mainfrom
hypeship/vz-shim-identity
Draft

yummybomb wants to merge 1 commit into
mainfrom
hypeship/vz-shim-identity

Conversation

@yummybomb

Copy link
Copy Markdown
Contributor

Summary

On macOS, teardown no longer signals a guest by its stored PID alone, and the shim lookup matches on the process name and its configured control socket.

Split out of #555. Independent of the other splits.

Why

Darwin has no recorded process start time, so a stored shim PID that is still in use may belong to an unrelated process. resolveLiveHypervisorPID returned the stored PID whenever one was recorded. The shim lookup matched any process whose arguments mentioned the socket path.

What changes

  • On non-Linux hosts, resolveLiveHypervisorPID always resolves the unique vz-shim configured for the instance's control socket. If none is found and a stored PID is still live, it returns an error.
  • vzShimPIDsFromPS requires the process name to be vz-shim and the control_socket in its -config argument to equal the socket path.

Testing

  • lib/hypervisor shim parsing tests pass on Linux.
  • TestDarwinTeardownRequiresMatchingShim is darwin-only and was not run. It is left to test-darwin.

Not reproduced

Nothing here was run on a Mac.

Review notes

  • A stopped guest whose stored PID has been reused by a live, unrelated process now gets an error from stop and delete until that process exits.

Darwin has no recorded process start time, so a stored shim PID that is
still in use may belong to an unrelated process. Teardown resolved the
PID from metadata whenever one was stored and only looked for the shim
by its control socket when none was. It now always requires the unique
vz-shim configured for the instance's control socket, and fails if the
stored PID cannot be confirmed.

The shim lookup matched any process whose arguments mentioned the
socket. It now matches on the process name and the control_socket in
the shim's -config argument.

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