WASI: WebAssembly System Interface

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • WASI

    WebAssembly System Interface

  • > Like WTF does this mean? The repo tells me nothing

    Directly above the sentence you quoted:

    "Interposition in the context of WASI interfaces is the ability for a Webassembly instance to implement a given WASI interface, and for a consumer WebAssembly instance to be able to use this implementation transparently. This can be used to adapt or attenuate the functionality of a WASI API without changing the code using it."

    > and I've still yet to see a clear write-up about what WASI is.

    In the same document: [0]

    > WTF is wit?

    The first link in that document ("Starting in Preview2, WASI APIs are defined using the Wit IDL.") is [1].

    > I click on "legacy" and I see preview0 and preview1, which are basically unreadable proto-specs.

    The README for the legacy directory [2] clearly explains what they are.

    > Where's a single well-written WASI spec?

    "Development of each API happens in its own repo, which you can access from the proposals list." [3]

    > Whatever WASI is doing, I don't like it.

    Clearly not - you've gone out of your way to ignore all of the documentation that answers your questions.

    > And neither does AssemblyScript team apparently

    The AssemblyScript team have a bone to pick with WASI based on their misunderstanding of what WASI is for (it is not intended for use on the web) and WASI's disinterest in supporting UTF-16 strings. You can see for yourself in [4].

    [0]: https://github.com/WebAssembly/WASI/tree/main#wasi-high-leve...

  • wasi-sdk

    WASI-enabled WebAssembly C/C++ toolchain

  • There is the WASI SDK if you want to target WASI from C/C++:

    https://github.com/WebAssembly/wasi-sdk

    It may not have all the amenities of Emscripten, but it's way less bulky.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • component-model

    Repository for design and specification of the Component Model

  • multi-memory

    Multiple per-module memories for Wasm

  • Thanks! These claims are really interesting.

    - WASM has no ASLR.

    So I guess if a buffer overrun lets you modify a function pointer, you could replace that function pointer with another pointer to execute different code. As you say, this is hard in native linux programs because ASLR and NX. You need a pointer to some code thats loaded in memory and you need to know where it is. In wasm, the "pointer" isn't a pointer at all. indirect_call takes an index into the jump table. Yes, this makes it easier to find other valid function pointers. But wasm also has some advantages here. Unlike in native code, you can't "call" arbitrary locations in memory. And indirect_call is also runtime typechecked. So you can't call functions with an unexpected type signature. Also (I think) the jump table itself can't be edited by the running wasm module. So there's no way to inject code into the module and run it.

    I could be wrong, but I wouldn't be surprised if on balance wasm still ends up safer than native code here. I'm sure there will be more than zero wasm sandbox escapes made by abusing this, but I haven't heard of any so far.

    Docs: https://developer.mozilla.org/en-US/docs/WebAssembly/Underst...

    - WASM allows writing to 0x0.

    You're probably right about this. To be clear, it means if pointers are set to 0 then dereferenced, the program might continue before crashing. And the memory around 0 may be overwritten by an attacker. How bad this is in practice depends on the prevelance of use-after-free bugs (common in C / C++) and what ends up near 0 in memory. In rust, these sort of software bugs seem incredibly rare. And I wouldn't be surprised if wasm compilers for C/C++ start making a memory deadzone here - if they aren't doing that already.

    - wasm can easily overflow buffers

    Sure, but so can native C code. And unlike native code, wasm can't overflow buffers outside of the data section. So you can't overwrite methods or modify the memory of any other loaded modules. So on net, wasm is still marginally safer than native code here. If you're worried about buffer overflows, use a safer language.

    - wasm doesn't have the concept of read-only memory

    Interesting! I can see this definitely being useful for system libraries like mmap. This would definitely be nice to have, and it looks like the wasm authors agree with you.

    https://github.com/WebAssembly/multi-memory/issues/15

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts