logoalt Hacker News

Is 'fork' missing operation in sandboxes?

9 points • by damezumari • last Thursday at 1:28 PM • 5 comments • view on HN

Comments

thepoet • today at 9:40 AM

Nice writeup. The step after forking paused sandboxes would be to fork live running sandboxes with the RAM, device state and disk all being forked. Get the same execution point with all processes still running rather than having to resume. You then also have to take care of kernel RNG state, boot ID, clocks, cached session keys etc. before the forked version starts meaningful work.

Disclosure: I am working an open-source KVM-based VMM for agent sandboxes, https://github.com/instavm/tarit

damezumari • last Thursday at 1:28 PM

I wrote up about our sandboxes. Everyone and their dog is offering them, but I think the fork operation is somewhat interesting at least for our own use - being able to fire copies of sandbox with a single API call has been convenient for our agentic use (reusing all earlier setup steps has saved lots of time and tokens).

Disclaimer: I know there's some more effort 'snapshotting' and other concepts elsewhere too, but from our point of view making it first-class citizen in both UI and API felt sensible and it has been useful.

jstanley • today at 9:34 AM

I'm curious how you handle open TCP sockets etc. at forking time? Do all sockets just get closed on one branch of the fork?

EDIT: I see you're only cloning filesystem contents, never mind.

➕ show 1 reply
verdverm • last Thursday at 5:45 PM

You can do this at the container layer level with Dagger. Forking and time travel were my primary aims when building an agent sandbox on top of Dagger.