Confirm hypervisor identity by process start time before kill - #379
Closed
yummybomb wants to merge 1 commit into
Closed
Confirm hypervisor identity by process start time before kill#379yummybomb wants to merge 1 commit into
yummybomb wants to merge 1 commit into
Conversation
Contributor
Author
|
closing — fix to be folded into #363 by the stack owner |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
/proc/<pid>/statstart time alongside the hypervisor PIDwhy
QEMU can close its QMP listener before the process exits. During that window, socket ownership lookup returns
ErrNoOwningProcess, so delete or stop refuses to kill the still-live process. Cloud Hypervisor can hit an equivalent/procscan race, and duplicate socket inode resolution can fail the same cleanup path.The persisted process start time confirms that the stored PID still refers to the original hypervisor without depending on the socket. A recycled PID has a different start time and remains fail-closed. Pre-upgrade metadata without
HypervisorStartTimedeserializes to zero and retains the existing socket-confirmation behavior.This is intended to be folded into #363.
HypervisorProcessExistsand API orphan cleanup retain their existing fail-open behavior and are out of scope.tests
Passed:
go build ./...go vet ./lib/instances/...go vet ./...go test ./lib/instances/ -run 'TestResolveLiveHypervisorPID|TestKillHypervisor|TestForceKillHypervisor|TestRefreshHypervisorPID|TestVGPUAssignmentClaimed|TestHypervisorProcessExists|TestProcessStartTime' -v -count=2lib/instancestop-level tests selected from unit-test filesEnvironment-limited:
go test ./lib/instances/ -shortdoes not exclude this package's integration tests; the run failed on missingmkfs.erofs, image preparation, and unprivileged network/hypervisor requirements. The non-integration subset above passed after separating those tests.sudo go test ./lib/instances/ -run 'TestQEMUStandbyAndRestore' -v -timeout 30mreached QEMU startup but failed because/dev/vhost-vsockis unavailable. The focused missing-socket kill-path test passes deterministically; CI can exercise the full lifecycle.TestCreateInstanceWithNetworkwas not rerun because the same host lacks/dev/vhost-vsock.