Repository navigation
Conversation
A TAP is named after the first eight characters of its instance ID, so two guests whose IDs share that prefix share a TAP name. Creating an allocation replaced whatever link had the name, and releasing one deleted it, whichever guest it belonged to. Reserving or recreating an allocation now fails if another guest directory maps to the same TAP name, and a release leaves a live TAP alone when the name is ambiguous. Both release paths use the same check, and a release reports a TAP it could not delete instead of only logging it; callers that tear a guest down still continue, leaving the TAP to the TAP reconciler.
This branch has not been deployed
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
An allocation is refused, and a release leaves the TAP alone, when another guest directory maps to the same short TAP name.
Split out of #555. Stacked on the fork recovery PR.
Why
A TAP is named after the first eight characters of its instance ID. Two guests whose IDs share that prefix share a name: creating an allocation replaces the link, and releasing one deletes it, whichever guest it belongs to.
What changes
reserveAllocationIdentityLockedandRecreateAllocationfail if another guest directory has the same TAP name.ReleaseByInstanceIDuses the same check.ReleaseAllocationreturns an error for a TAP it could not delete. Callers that tear a guest down log it and continue.deleteTAPDevicereturns netlink errors other than "not found".Testing
TestRecoveryReleasesOnlyUnambiguousKernelTAPcreates real TAPs. Its four cases passed as root in a private network namespace on a staging host: an unambiguous TAP is deleted with its fork, a shared name is left in place.Running, delete, and the kill-and-restart runs behave as on the fork recovery branch, with no TAP left.Not reproduced
The collision itself. IDs are generated, so two guests sharing an eight-character prefix could not be made through the API. With about 2e12 possible prefixes, 1,000 guests on a host collide with a probability of about 2.5e-7.
The TAP leak that was reproduced (a fork killed before its allocation is saved) is fixed in the fork recovery PR, not here.
Review notes