zlacker

Microsandbox: Virtual Machines that feel and perform like containers

submitted by makebo+(OP) on 2025-05-30 13:20:04 | 402 points 186 comments
[view article] [source] [go to bottom]

NOTE: showing posts with links only show all posts
2. Tsarp+Zd[view] [source] 2025-05-30 14:54:32
>>makebo+(OP)
Wow. This looks awesome.

Can we build our own python sandbox using the sandboxfile spec? This is if I want to add my own packages. Would this be just having my own requirements file here - https://github.com/microsandbox/microsandbox/blob/main/MSB_V...

◧◩
3. esafak+ie[view] [source] [discussion] 2025-05-30 14:56:23
>>appcyp+Y6
Looks neat. If I understand correctly, I can use it to spin up backends on the fly? You have an ambitious list of languages to support: https://github.com/microsandbox/microsandbox/tree/main/sdk

edit: A fleshed out contributors guide to add support for a new language would help. https://github.com/microsandbox/microsandbox/blob/main/CONTR...

7. jaunty+Ug[view] [source] 2025-05-30 15:13:26
>>makebo+(OP)
Why not some of the existing microvm efforts?

Cloud Hypervisor and Firecracker both have an excellent reputation for ultra lightweight VM's. Both are usable in the very popular Kata Containers project (as well as other upstart VM's Dragonball, & StratoVirt). In us by for example the CNCF Confidential Containers https://github.com/kata-containers/kata-containers/blob/main... https://confidentialcontainers.org/

There's also smaller efforts such as firecracker-containerd or Virtink, both which bring OCI powered microvms into a Docker like position (easy to slot into Kubernetes), via Firecracker and Cloud Hypervisor respectively. https://github.com/smartxworks/virtink https://github.com/firecracker-microvm/firecracker-container...

Poking around under the hood, microsandbox appears to use krun. There is krunvm for OCI support (includes MacOS/arm64 support!). https://github.com/containers/krunvm https://github.com/slp/krun

The orientation as a safe sandbox for AI / MCP tools is a very nicely packaged looking experience, and very well marketred. Congratulations! I'm still not sure why this warrants being it's own project.

◧◩
22. jeroen+5o[view] [source] [discussion] 2025-05-30 15:53:52
>>datafl+0h
You can optimize a lot to start a Linux kernel in under a second, but if you're using a standard kernel, there are all manners of timeouts and poll attempts that make the kernel waste time booting. There's also a non-trivial amount of time the VM spends in the UEFI/CSM system preparing the virtual hardware and initializing the system environment for your bootloader. I'm pretty sure WSL2 uses a special kernel to avoid the unnecessary overhead.

You also need to start OS services, configure filesystems, prepare caches, configure networking, and so on. If you're not booting UKIs or similar tools, you'll also be loading a bootloader, then loading an initramfs into memory, then loading the main OS and starting the services you actually need, with eachsstep requiring certain daemons and hardware probes to work correctly.

There are tools to fix this problem. Amazon's Firecracker can start a Linux VM in a time similar to that of a container (milliseconds) by basically storing the initialized state of the VM and loading that into memory instead of actually performing a real boot. https://firecracker-microvm.github.io/

On Windows, I think it depends on the hypervisor you use. Hyper V has a pretty slow UEFI environment, its hard disk access always seems rather slow to me, and most Linux distro don't seem to package dedicated minimal kernels for it.

◧◩◪◨
24. westur+Ao[view] [source] [discussion] 2025-05-30 15:57:05
>>appcyp+Hg
> I would consider Docker for VMs instead.

Native Containers would probably solve here, too.

From >>43553198 :

>>> ostree native containers are bootable host images that can also be built and signed with a SLSA provenance attestation; https://coreos.github.io/rpm-ostree/container/

And also from that thread:

> How should a microkernel run (WASI) WASM runtimes?

What is the most minimal microvm for WASM / WASI, and what are the advantages to running WASM workloads with firecracker or microsandbox?

◧◩◪
26. appcyp+tp[view] [source] [discussion] 2025-05-30 16:03:04
>>hugs+Bk
Yes! With the `scope` property.

https://github.com/microsandbox/microsandbox/blob/0c13fc27ab...

◧◩◪◨⬒
29. tough+yq[view] [source] [discussion] 2025-05-30 16:10:28
>>simonw+Qm
I had luck using ALVM which users Apple Hypervisor framework while exploring linux micro-vm's in macos fwiw https://github.com/mathetake/alvm
32. McAlpi+Rr[view] [source] 2025-05-30 16:18:42
>>makebo+(OP)
This looks awesome. The amount of super lightweight and almost-disposable VM options in recent years is crazy. I remember when VMs were slow, clunky, and generally painful.

I wonder how this compares to Orbstack's [0] tech stack on macOS, specifically the "Linux machines" [1] feature. Seems like Orb might reuse a single VM?

---

[0] https://orbstack.dev

[1] https://docs.orbstack.dev/machines/

35. jbvers+dt[view] [source] 2025-05-30 16:28:26
>>makebo+(OP)
Related, https://github.com/jrz/container-shell which uses docker to create adhoc shells / chroots in the current directory.
39. jmehma+Tu[view] [source] 2025-05-30 16:40:37
>>makebo+(OP)
I've been looking for something I could host for this kind of thing - for LLM agents. Ended up on https://www.daytona.io/ as I couldn't find anything suitable to self host and realised it was a complex thing to manage. It seems Daytona is open source, including the server platform, but there is no documentation for the server element. Azure also seem to offer a service for this, it's a space that is growing rapidly.
◧◩◪◨⬒
67. ericb+BH[view] [source] [discussion] 2025-05-30 18:14:17
>>simonw+Qm
Working gVisor Mac install instructions here.

https://dev.to/rimelek/using-gvisors-container-runtime-in-do...

After this is done, it is:

docker run --rm --runtime=runsc hello-world

◧◩◪◨⬒⬓
87. westur+TR[view] [source] [discussion] 2025-05-30 19:39:13
>>appcyp+Is
From https://e2b.dev/blog/firecracker-vs-qemu

> AWS built [Firecracker (which is built on KVM)] to power Lambda and Fargate [2], where they need to quickly spin up isolated environments for running customer code. Companies like E2B use Firecracker to run AI generated code securily in the cloud, while Fly.io uses it to run lightweight container-like VMs at the edge [4, 5].

"We replaced Firecracker with QEMU" (2023) >>36666782

"Firecracker's Kernel Support Policy" describes compatible kernel configurations; https://github.com/firecracker-microvm/firecracker/blob/main...

/? wasi microvm kernel [github] https://www.google.com/search?q=wasi+microvm+kernel+GitHub :

- "Mewz: Lightweight Execution Environment for WebAssembly with High Isolation and Portability using Unikernels" (2024) https://arxiv.org/abs/2411.01129 similar: https://scholar.google.com/scholar?q=related:b3657VNcyJ0J:sc...

◧◩◪
91. akdev1+wT[view] [source] [discussion] 2025-05-30 19:56:15
>>bjackm+BR
One can definitely build a container runtime that uses virtualization to protect the host

For example there is Kata containers

https://katacontainers.io/

This can be used with regular `podman` by just changing the container runtime so there’s no even need for any extra tooling

In theory you could shove the container runtime into something like k8s

◧◩◪
95. ignora+NV[view] [source] [discussion] 2025-05-30 20:21:17
>>bjackm+BR
> ... drastically restrict the syscall API surface available to the sandboxee, which quickly reduces its value ...

Depends I guess as Android has had quite a bit of success with seccomp-bpf & Android-specific flavour of SELinux [0]

> Until we have a properly hardened and memory safe OS ... faster than running MicroVMs on a Linux host.

Andy Tanenbaum might say, Micro Kernels would do just as well.

[0] https://youtu.be/WxbOq8IGEiE

◧◩◪◨⬒⬓
100. gopher+R01[view] [source] [discussion] 2025-05-30 21:06:07
>>datafl+zw
I remembered something about VirtualBox not playing nicely with Hyper-V on Windows, and dug up a possibly relevant post[0] on their forums. IIRC we ended up moving a few build systems to Docker and dropping VirtualBox because of hyper-v related issues, but it's been a few years.

[0] https://forums.virtualbox.org/viewtopic.php?t=112113

◧◩◪
102. appcyp+G31[view] [source] [discussion] 2025-05-30 21:29:51
>>simonw+nT
Right. You can skip the `with` context manager and call start and stop yourself.

There is an example of that here:

https://github.com/microsandbox/microsandbox/blob/0c13fc27ab...

◧◩◪
106. gcharb+L41[view] [source] [discussion] 2025-05-30 21:39:01
>>simonw+nT
async with is just syntactic sugar. You could very well call __aenter__ and __aexit__ manually. You could also use an AsyncExitStack, call __aenter__ manually, then enter_async_context, and call aclose when you’re done. Since aclose method exists I guess this is not an anti-pattern.

https://docs.python.org/3/library/contextlib.html#contextlib...

◧◩◪◨
122. transp+Fl1[view] [source] [discussion] 2025-05-31 01:09:04
>>Veserv+jT
> You cannot build a secure virtualization runtime because underlying it is the VMM

There are VMMs (e.g. pKVM in upstream Linux) with small SLoC that are isolated by silicon support for nested virtualization. This can be found on recent Google Pixel phones/tablets with strong isolation of untrusted Debian Arm Linux "Terminal" VM.

A similar architecture was shipped a decade ago by Bromium and now on millions of HP business laptops, including hypervisor isolation of firmware, "Hypervisor Security : Lessons Learned — Ian Pratt, Bromium — Platform Security Summit 2018", https://www.youtube.com/watch?v=bNVe2y34dnM

Christian Slater, HP cybersecurity ("Wolf") edutainment on nested virt hypervisor in printers, https://www.youtube.com/watch?v=DjMSq3n3Gqs

◧◩
124. apitma+Mu1[view] [source] [discussion] 2025-05-31 03:50:08
>>Swifty+KB
You might be able to get away with running QuickJS compiled to WebAssembly: https://til.simonwillison.net/npm/self-hosted-quickjs
◧◩
128. meande+hD1[view] [source] [discussion] 2025-05-31 06:23:27
>>appcyp+Y6
Can you explain how this compares to Kata Containers? [0] That also supports OCI to run microVMs. You can also choose different hypervisors such as firecracker to run it on.

[0] https://katacontainers.io/

◧◩◪
143. raphin+DS1[view] [source] [discussion] 2025-05-31 10:09:02
>>appcyp+s41
In case you're interested when you set up proper distribution, I'm working on an open source solution aiming to improve security of downloads from the internet. Our first step is maintaining a mirror of checksums published in GitHub releases at https://github.com/asfaload/checksums/. If you publish a checksums file in your releases it can automatically be mirrored. The checksums mirror is not our end game, but it already protects against changes of released files from the time the mirror was taken. For anyone interested: https://asfaload.com/asfald/
◧◩◪◨⬒⬓
146. transp+hW1[view] [source] [discussion] 2025-05-31 11:00:47
>>delusi+tR1
> Is there any guarantee that this "silicon support" is any safer than the software?

Safety and security claims are only meaningful in the context of threat models. As described in the Xen/uXen/AX video, pKVM and AWS Nitro security talks, one goal is to reduce the size, function and complexity of open-source code running at the highest processor privilege levels [1], minimizing dependency on closed firmware/SMM/TrustZone. Nitro moved some functions (e.g. I/O virtualization) to separate processors, e.g. SmartNIC/DPU. Apple used an Arm T2 secure enclave processor for encryption and some I/O paths, when their main processor was still x86. OCP Caliptra RoT requires OSS firmware signed by both the OEM and hyperscaler customer. It's a never-ending process of reducing attack surface, prioritized by business context.

> hardware would be subject to exactly the same bugs as software would, except it will be hard to update of course

Some "hardware" functions can be updated via microcode, which has been used to mitigate speculative execution vulnerabilities, at the cost of performance.

[1] https://en.wikipedia.org/wiki/Protection_ring

[2] https://en.wikipedia.org/wiki/Transient_execution_CPU_vulner...

◧◩◪◨
147. transp+NX1[view] [source] [discussion] 2025-05-31 11:25:54
>>delusi+iR1
> hardware virtualization controlled by the local kernel

In some architectures, kernel LPE does not break platform (L0/EL2) virtualization, >>44141164

  L0/EL2  L1/EL1                   

  pKVM    KVM                  
  AX      Hyper-V / Xen / ESX
◧◩◪◨⬒⬓
149. simonw+J32[view] [source] [discussion] 2025-05-31 12:44:06
>>mike_h+iZ1
The lack of documentation for that system is so frustrating! Security feature are the one thing where great documentation should be table stakes, otherwise we are left just wildly guessing how to keep our system secure!

I'm also disheartened by how the man pages for some of the macOS sandboxing commands have declared them deprecated for at least the last five years: https://7402.org/blog/2020/macos-sandboxing-of-folder.html

◧◩
152. arjunb+ta2[view] [source] [discussion] 2025-05-31 13:56:49
>>Swifty+KB
I recommend trying Javy[0]. Javy allows you to build a WASM file that includes Javy's JS interpreter along with your JS source code. Note that Javy is a heavily sandboxed environment so it doesn't have access to the internet, or npm modules, a desirable feature for running user code.

We're building an IoT Cloud Platform, Fostrom[1] where we're using Javy to power our Actions infrastructure. But instead of compiling each Action's JS code to a Javy WASM module, I figured out a simpler way by creating a single WASM module with our wrapper code (which contains some further isolation and helpful functions), and we provide the user code as an input while executing the single pre-compiled WASM module.

[0] https://github.com/bytecodealliance/javy

[1] https://fostrom.io

◧◩
172. int_19+dR2[view] [source] [discussion] 2025-05-31 21:15:47
>>appcyp+Y6
This is very neat tech, but I think you might want to wait until you actually have Windows covered before making claims like https://github.com/microsandbox/microsandbox/blob/main/MSB_V...
◧◩◪
181. yencab+l93[view] [source] [discussion] 2025-06-01 01:39:51
>>apitma+Mu1
Convenience helper for that: https://github.com/bytecodealliance/javy
◧◩◪
182. spixy+bu3[view] [source] [discussion] 2025-06-01 08:10:19
>>appcyp+4D
Windows has built-in sandbox and its good.

https://learn.microsoft.com/en-us/windows/security/applicati...

◧◩
183. spixy+fu3[view] [source] [discussion] 2025-06-01 08:11:26
>>Jayaku+ji
Windows already has built-in sandbox and its good.

https://learn.microsoft.com/en-us/windows/security/applicati...

◧◩◪◨⬒⬓
185. hnuser+Bl9[view] [source] [discussion] 2025-06-03 16:40:25
>>naikro+F33
"ME can also control various aspects of the Virtualization Engine directly over the ME Command Interface (MECI)."

https://en.wikichip.org/wiki/intel/management_engine

[go to top]