logoalt Hacker News

7373737373today at 10:06 AM4 repliesview on HN

Noob question: why did they not choose to use WebAssembly in the kernel instead?


Replies

danudeytoday at 5:07 PM

eBPF has a lot more checks in the verifier, which you could read about here if you're interested in learning more: https://docs.kernel.org/bpf/verifier.html

Since you don't want to handle any kind of crash, out of bounds exception, etc., the eBPF verifier does a ton of impressively paranoid stuff. It ensures that the program doesn't loop (or if it loops that the loop is provably bounded and cannot be infinite), it guarantees that you don't read from a register that might not have been written to, etc.

Basically, it needs to be able to mathematically prove without a doubt that the program behaves as it's supposed to or the verifier refuses to load it at all. WASM doesn't do that, since WASM is a general-purpose 'machine' and WASM programs could theoretically just run forever in entirely reasonable cases.

dwattttttoday at 1:11 PM

eBPF predates WebAssembly by a few years. I'm also not sure Linux would've wanted to integrate and rely so heavily on a standard they aren't in control of the design of.

tptacektoday at 1:32 PM

eBPF has much stronger constraints than WebAssembly.

paul_knoxtoday at 2:27 PM

if you crash in wasm, your tab dies. if you crash in ebpf, your server dies. different stakes.