Repository navigation
doc: extend the fork safety guidance to snapshot and checkpoint restores - #6049
Merged
Merged
Conversation
A process or a virtual machine restored from a saved image is duplicated without a fork: the process ID does not change, so the pid and fork generation checks of Stateful_RNG see nothing and every copy continues from the state in the image. AutoSeeded_RNG's per-request draw from the system RNG keeps the output distinct where the operating system's generator was itself reseeded at the restore; the internal state is the image's until the next reseed. Say so beside the fork safety section, recommend an explicit reseed after a restore as after a fork, and name the signals a platform offers (a restore hook; on Linux 7.0 and later the VMClock page's vm_generation_counter).
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.
Documentation only: a short section after "Fork Safety" in
doc/api_ref/rng.rston snapshot andcheckpoint restores, as discussed with Jack by mail.
A process or a virtual machine restored from a saved image (a VM snapshot, a CRIU checkpoint, a
function resumed from an image) is duplicated without a fork: the process ID does not change, so
the pid and fork-generation checks of
Stateful_RNGsee nothing and every copy continues from thestate in the image.
AutoSeeded_RNG's per-request draw from the system RNG keeps the outputdistinct between the copies where the operating system's own generator was reseeded at the
restore (on Linux, when the hypervisor provides a VM generation ID and the guest kernel carries
the vmgenid driver); the internal state is the image's until the next reseed. Measured: two
continuations of one QEMU or Firecracker snapshot print distinct
AutoSeeded_RNGoutput while agenerate call with a fixed additional input shows the first draw after the restore coming from
the duplicated state; in a guest whose kernel had no restore signal the first block repeated with
the kernel's.
The section recommends an explicit reseed after a restore, as the fork section does after a
fork, and names the signals a platform offers (a restore hook; on Linux 7.0 and later the
vm_generation_counterof the VMClock page,/dev/vmclock0). Please edit freely.