Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Started learning it recently (considered go too).

Between it getting included in Kernel and the whole WASM thing it seems reasonably future safe



sort by: page size:

At first glance it looks a lot like Go, but you can already compile Go to WASM I believe.

In which case I'm curious what are the differences or use case vs just using Go?


Go can also compile to WASM.

Yeah, you can compile to WASM since the last few versions of Go (1.10 or 1.11)!

I didn't even know they were working on wasm for Go, but it looks like there was some progress during the last months:

https://github.com/golang/go/issues/18892


It's well suited for permissionless compute.

Only issue is, not all languages that compile to WASM are deterministic.


wasm in the kernel when?

Very cool. I'd actually like to see something like this for Go as well due to the insanely fast compile times. Compiling into wasm of course.

Doesn't WASM need GC support before Go can be used? It'll need to be fully managed languages until then, I think.

With that said I'm just parroting some other comments I've seen on this topic in other contexts, so I'm asking the question genuinely.


I wonder how safe the their (wazero's) approach is from the security point of view. According to the article (and I know it myself too after studying the Go runtime), the Go runtime is quite finicky when it comes to execution of foreign code because it can easily interfer with the goroutine scheduler, GC, etc. (unless you use CGO which deals with it, but they don't use it). As the article explains, it's easy to introduce random crashes by, say, innocently using a "wrong" register. Also, the Go runtime can change considerably from version to version (say, when they introduced preempted scheduling based on signals, or when they moved away from segmented stacks etc.), and so today Wazero may work OK but with a new Go version it may unexpectedly crash or corrupt memory in some subtle ways. Considering that the whole point of WASM is sandboxing, reading this article didn't make me feel very confident about the project.

I suppose it's not strange to see WASM come up -- last weekend I was considering doing something even weirder: writing a WASM to Thumb2 AoT compiler so I could leverage Go's built-in WASM support.

This project seems more immediately useful :)


It's pretty relevant to the discussion of "why would you want to run wasm in the kernel", but I'm not too worried about the votes.

I'm not just being diplomatic when I say that hopefully we can avoid the Rust vs. Go debate here. :P WASM is a bid to help future-proof the relevancy of the web in the face of mobile app stores, and seeing many languages embrace it is a good thing, no matter what those languages are. Heck, since WASM is sandboxed anyway it doesn't even matter if you choose C or C++ over Go or Rust, since memory unsafety shouldn't be exploitable from WASM anyway.

Does anybody know if that kernel module can execute WASM generated from Go or Rust too?

This is a good development and shows that there is appetite to move on to new, safer languages.

What would be even better, IMHO, would be to bring full software fault isolation (SFI) into the kernel and move to a model where many kernel services are implemented as Wasm modules.


It's good to see an example of Go running in the browser via WebAssembly. I've been trying to decide between Go and C++ for targeting WASM, but it's not clear whether Go is a good choice for this and whether WASM support is a priority for the language's developers.

There are actually plenty of wasm first projects in Go.

And tinygo is an alternative compiler that implements another GC algorithm and aims at shipping small binaries, including wasm files.


No. Wasm is still executing on a virtual machine, and native compiled go code will still be native.

Just thinking out loud, does go compile to WASM? I often see performance critical WASM snippets written in rust, but never in Go.

I guess you're getting downvotes because you posted this without explanation, but wasm actually makes a lot of sense for safer kernel extensions, as it allows for sandboxing code running as ring 0.
next

Legal | privacy