Merged
Conversation
On macOS, libkrun's init.krun forks a child for the timesync clock_worker. When the vsock DGRAM bind fails, clock_worker returns instead of calling _exit(), so the child falls through into the main init path and execs a second bbox-init. Add an flock(LOCK_EX|LOCK_NB) guard so the second instance blocks forever instead of racing with the first. Workaround for containers/libkrun#580 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ca1d935 to
d052d51
Compare
JAORMX
approved these changes
Mar 11, 2026
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.
On macOS, libkrun spawns two init.krun processes, each of which
fork+execs bbox-init. Without a guard, the duplicate init races
with the primary on tmpfs mounts and network configuration.
Use flock(LOCK_EX|LOCK_NB) on /bbox-init.lock as an atomic guard.
The losing instance blocks on a signal channel forever instead of
exiting, because exit would cause its parent init.krun to call
reboot(POWER_OFF), killing the entire VM.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com