Don't forget about entropy! You've just created two identical copies of all of your random number generators, which could be very very bad for security. The firecracker team wrote a very good paper about addressing this when they added snapshot support.
Show HN: Sub-millisecond VM sandboxes using CoW memory forking
31–40 of 85 posts
Re: Show HN: Sub-millisecond VM sandboxes using CoW memory forking
#32This is how android processes work, but it's a security problem breaking some ASLR type things.
Re: Show HN: Sub-millisecond VM sandboxes using CoW memory forking
#33Re: Show HN: Sub-millisecond VM sandboxes using CoW memory forking
#34The tricky part of doing this in production is cloning sandboxes across nodes. You would have to snapshot the resident memory, file system (or a CoW layer on top of the rootfs), move the data across nodes, etc.
Re: Show HN: Sub-millisecond VM sandboxes using CoW memory forking
#35Earlier quoted context omitted.
simonw seems like he's always wanting what you describe, maybe more for wasm though
I’ve been a big fan of “what’s the thinnest this could be” interpretations of sandboxes. This is a great example of that. On the other end of the spectrum there’s just-bash from the Vercel folks.
Re: Show HN: Sub-millisecond VM sandboxes using CoW memory forking
#36Don't forget about entropy! You've just created two identical copies of all of your random number generators, which could be very very bad for security. The firecracker team wrote a very good paper about addressing this when they added snapshot support.
Good callout. We seed entropy before snapshot to unblock getrandom(), but forks still share CSPRNG state. The proper fix per Firecracker’s docs is RNDADDENTROPY + RNDRESEEDCRNG after each fork, plus reseeding userspace PRNGs like numpy separately. On the roadmap. https://github.com/firecracker-microvm/firecracker/blob/main...
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
So that just (!) leaves userspace PRNGs.
Re: Show HN: Sub-millisecond VM sandboxes using CoW memory forking
#37Re: Show HN: Sub-millisecond VM sandboxes using CoW memory forking
#38[flagged]
On snapshot staleness: yes, forks inherit all internal state including RNG seeds. For dependency updates you rebuild the template (~15s). No incremental update - full re-snapshot, similar to rebuilding a Docker image.
On the memory number: 265KB is the fork overhead before any code runs. Under real workloads we measured 3.5MB for a trivial print(), ~27MB for numpy operations. But 93% of pages stay shared across forks via CoW. We measured 100 VMs each running numpy sharing 2.4GB of read-only pages with only 1.75MB private per VM. So the real comparison to E2B's ~128MB is more like 3-27MB depending on workload, with most of the runtime memory shared.
Re: Show HN: Sub-millisecond VM sandboxes using CoW memory forking
#39Does it only work with that specific version of firecracker and only with vms with 1 vcpu? More than the sub ms startup time the 258kb of ram per VM is huge.
On Firecracker version: tested with v1.12, but the vmstate parser auto-detects offsets rather than hardcoding them, so it should work across versions.