Skip to content

A Users or Net restart during a boot hands one uid or NetId to two VMs #210

Backlog

Description

@markovejnovic

Found by model checking (the Quint specs in #206). A counterexample in the model, each step read in the code at e281a48. Not reproduced on a running system.

  • Where: lib/hyper/node.ex:66-84: Users and Net sit under :rest_for_one ahead of the VM supervisor. node.ex:101-110 and 181-186: a boot claims its ids first and builds the rootfs before it starts the VM.
  • Chain:
    1. Boot A claims uid U and is still in Img.create_mutable/3.
    2. Users crashes. :rest_for_one restarts it with an empty state and kills every VM. A's boot runs in its caller's process and survives.
    3. The fresh pool counts up from its minimum again and hands U to boot B: at once if U was the lowest id, otherwise after as many claims as came before A's.
    4. A starts its VM on U as well.
  • Effect: two VMs on one uid. The same goes for Net and a NetId. If A's boot fails instead, its late release puts U on the fresh pool's free queue while B runs on it.
  • Trigger: a pool process crashing while any boot is between its claim and its bind.
  • Model: id_pool_small --step stepPoolRestart violates idExclusive. The trace, from spec/ on that branch after npm ci:
    node_modules/.bin/quint run id_pool.qnt --main id_pool_small --step stepPoolRestart \
      --invariant idExclusive --max-samples 100000 --max-steps 40
  • Repro: not written. E2E: kill Hyper.Node.Net while a boot is in create_mutable, boot again, and compare the NetIds.
  • Fix: one option is to stamp each claim with the pool's incarnation and have the boot fail when the pool that issued its id is gone. Related: Give each VM its own supervision subtree for its resources #97.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Fields

    No fields configured for issues without a type.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions