Unofficial Hacker News companion — get notified on comment replies, and more.

Unkernel: Real Linux kernel, compiled to WebAssembly (opens external site)

621 points by nreece 4 days ago | unkernel.dev | 172 comments on HN | Vote on HN (opens Hacker News) |

View full thread · View on Hacker News

Comment thread (5)

  1. Interesting article!

    > Why bother with a hypervisor when you can just compile to Wasm and boot the identical binaries on anything

    I’m not convinced hypervisors are going away because they present a far smaller attack surface than a JIT Wasm runtime.

    One thing that’s unclear to me is what advantage compiling the Linux Kernel to Wasm provides when user land is still emulated over running the Linux kernel itself in the emulator.

    Replies (3)
    1. > I’m not convinced hypervisors are going away because they present a far smaller attack surface than a JIT Wasm runtime.

      The attack surface for VMs in the kernel is quite large - the whole KVM system and related qemu/other VMM functionality (user space drivers of all sorts etc).

      Yes a JIT Wasm runtime is not ideal but wasm in general is very robust and safe. Before a module is added to the rest of the wasm/javascript code, it is validated by a wasm checker. If is is malformed in any way it will be rejected

      Replies (1)
      1. KVM plus a minimal hypervisor is still an order of magnitude smaller than something like wasmtime though. The risk is not so much malformed Wasm/javascript code but the risk of exploiting miscompilation by the JIT. Wasm interpreters are much smaller and safer but much, much slower.
    2. I work on a competing project (Neutrium, arm64 Linux in the browser). We run the real kernel under full arm64 emulation, not a kernel compiled to wasm.

      From what I measured, compiling the kernel to wasm is not worth it. In real work the kernel is used very little. Kernel time is only around 5-15% of total CPU time.

      Our numbers: - next dev with turbopack: sys 5.3 s vs 41 s core time - C compile: 3-11% - test suite: 5-16% - npm install is higher (28%), but most of it is page faults and TLB. The syscalls themselves are only 2-13% of that.

      So even if kernel cost goes to zero, you get maybe 1.1x. The other ~90% is arm64 user code, and both designs have to emulate it. That is the real problem.

      To be fair, their syscall path may be faster than ours.

    3. > I’m not convinced hypervisors are going away

      Neither am I. I am a reporter. I am reporting this stuff. That does not mean I agree with it, or believe it myself.

      It's interesting tech and I knew very well that, with the short attention spans and short memories of people on the WWW these days, and the likelihood that people didn't read back, didn't watch the talks, etc. that they wouldn't understand what this was about.

      Then, just a couple of days later, here's a whole thread proving just that.

      Frankly, what I personally feel is Inferno and Dis was a better idea than Wasm, just as it was a better idea than the JVM 30 years ago. And Taos was more impressive than Inferno.

      We should strive for smaller, simpler, and faster, not bigger and more feature-rich and more complicated.

      If people need VMs and want to run OSes in VMs we should be actively designing OSes that are intended to run in VMs and which do not support real hardware. That's how IBM did it in the 1960s, as I pointed out in this 5-part article series a decade and a half ago:

      https://www.theregister.com/software/2011/07/11/before-the-c...

      https://www.theregister.com/software/2011/07/14/before-the-p...

      https://www.theregister.com/software/2011/07/18/fun-and-game...

      https://www.theregister.com/on-prem/2011/07/21/virtualisatio...

      https://www.theregister.com/on-prem/2011/07/25/cheap-as-chip...

      Part 3 predicts that containers will be the next big thing in the Linux space, about 3 full years before Docker was founded.