Live data from Hacker News

The Bytecode Alliance: Building a secure, composable future for WebAssembly

hacks.mozilla.org

181–190 of 265 posts

Re: The Bytecode Alliance: Building a secure, composable future for WebAssembly

#181
post #120

Stupid question from a non specialist. I see Intel in the list of parties. Does that mean hardware acceleration for wasm?

Among other things, yes; we're contributing to the SIMD support, for instance.

Anything beyond just the 128-bit SIMD yet? Last thing I seen on that was "Long SIMD" from here: https://webassembly.org/docs/future-features/

And that was years ago.

Seems like an awful waste to have many millions of cpus with avx for instance, wasted.

Re: The Bytecode Alliance: Building a secure, composable future for WebAssembly

#182
post #136

Earlier quoted context omitted.

It is meant to be compiled to native instructions, I don't think there is significant room for hardware acceleration.

I am talking from a position of ignorance, but intuitively I am sure the runtime does or will do lots of things, between the sandboxing, the linking, potential garbage collection, etc.

It isn't run through a run time, it is meant to be just in time compiled to native instructions. There isn't any garbage collection.

Re: The Bytecode Alliance: Building a secure, composable future for WebAssembly

#183
post #140

Earlier quoted context omitted.

Can you link to an example of this exploit? Does javascript suffer from the same problem?

Any kind of typical C memory corruption that you can think of that fails to validate the buffer sizes that you give as parameters. WebAssembly memory access bytecodes only do bounds checking of the linear memory block that gets allocated to the module. You then do your own memory management taking subsets from that memory block and assigning it to the respective internal heap allocations or global memory blocks. So y…

Wouldn't that just corrupt your own program? If there is a security flaw you could demonstrate it.

Re: The Bytecode Alliance: Building a secure, composable future for WebAssembly

#184
post #125

Earlier quoted context omitted.

Reading through this, this sounds like mostly a capability based architecture, with process isolation replaced with a statically typed bytecode in which you can verify that each module can only use capabilities passed to it. I was wondering why the focus on copying memory between the processes. It should be possible to make capabilities which represent a pointer and a length (and maybe an access mode), which could be…

What you're describing will indeed be introduced with the WebAssembly GC proposal: https://github.com/WebAssembly/gc For languages that can express unforgeable pointers as first-class concept, that is indeed a very attractive, fine-grained approach. Unfortunately bringing that to languages like C/C++/Rust is a different matter altogether. Since we want to support those languages as first-class citizens, we can't requ…

>Since we want to support those languages as first-class citizens, we can't require GC support as a base concept

I feel like you're overthinking it. Can't you just have a table that holds GCable objects and only hand out indexes to C and co?

Re: The Bytecode Alliance: Building a secure, composable future for WebAssembly

#185

Earlier quoted context omitted.

What you're describing will indeed be introduced with the WebAssembly GC proposal: https://github.com/WebAssembly/gc For languages that can express unforgeable pointers as first-class concept, that is indeed a very attractive, fine-grained approach. Unfortunately bringing that to languages like C/C++/Rust is a different matter altogether. Since we want to support those languages as first-class citizens, we can't requ…

> For languages that can express unforgeable pointers as first-class concept, that is indeed a very attractive, fine-grained approach. Unfortunately bringing that to languages like C/C++/Rust is a different matter altogether. The semantics of these languages aren’t incompatible with unforgeable references, though: it generally works in practice, but it’s technically undefined to create pointers out of thin air. Why c…

It's slow. You should read up on the challenges of implementing memcpy in C emulated on Java. Basically you have to manually implement paging.

Re: The Bytecode Alliance: Building a secure, composable future for WebAssembly

#187

I'm one of the folks working with the Alliance, and I'm incredibly excited about WebAssembly outside the browser. Happy to answer questions. Imagine extensions for applications or databases, written in any language you want, with no ability to exfiltrate data. Imagine supporting a safe plugin API that isn't just for C and languages that FFI to C, but works natively with safe datatypes. Today, if you want to be extens…

> Imagine embedding a WebAssembly runtime like wasmtime, and telling people they can write their extensions in any language they want. Is that desirable? Won't it lead to a bloated mess with every extension dragging in a different language runtime with it?

With several programs using wasm, the runtimes can be shared, the way shared libraries work in modern OSes, or shared assemblies .net.

Re: The Bytecode Alliance: Building a secure, composable future for WebAssembly

#188
post #130

Earlier quoted context omitted.

Actually it fails to properly sandbox C derived languages versus what hardware memory tagging like SPARC ADI and ARM are capable of, because it doesn't do bounds checks inside linear memory blocks.

Hardware memory tagging is not a requirement for sandboxing. Actually, hardware memory tagging doesn’t even fully restrict out-of-bounds accesses because it’s granularity is usually larger than a byte.

No one is saying it is a requirement, rather that WebAssembly design oversells security by not doing those checks.

Even if they would be at word level, it is already an improvement over the actual design.

Re: The Bytecode Alliance: Building a secure, composable future for WebAssembly

#189
post #111

Earlier quoted context omitted.

That is exactly the point, don't advertise WebAssembly as safe bytecode, if unsafe languages are part of the picture without any kind of control. Secondly, nor ISO C or ISO C++ forbid implementations that do bounds checking by default. In fact that is what most modern compilers do by default in debug mode. Finally look at memory tagging in Solaris SPARC ADI, Apple iOS or the upcoming ARM extensions support on Android…

The point of the byte code being safe is that no operations performed by WASM code could cause a memory unsafety bug from the perspective outside the sandbox. If your code violates its own memory rules then it will only mess up the logical state of its VM memory chunk, and probably produce an incorrect result. The same thing can happen in any safe language if you access the wrong indexes in an array because of a logi…

That incorrect results might lead to security exploits, the same way that browsers now get exploited by taking advantage how their VMs work.

So hand waving such security issues is rather strange, when it should be the top concern when selling an infrastructure to run code from unknown sources.

Re: The Bytecode Alliance: Building a secure, composable future for WebAssembly

#190
post #111

Earlier quoted context omitted.

That is exactly the point, don't advertise WebAssembly as safe bytecode, if unsafe languages are part of the picture without any kind of control. Secondly, nor ISO C or ISO C++ forbid implementations that do bounds checking by default. In fact that is what most modern compilers do by default in debug mode. Finally look at memory tagging in Solaris SPARC ADI, Apple iOS or the upcoming ARM extensions support on Android…

> In fact that is what most modern compilers do by default in debug mode. Assuming that “debug mode” is -g or equivalent, then I have not seen a modern compiler that does this.

Then get to use Visual C++, which does bounds checking on collection types (array, string, vector,...), memory dumps leaks at exit.

Or Solaris SPARC and iOS compilers that make use of hardware memory tagging.

Clang and GCC do need extra flags to enable FORTIFY mode though.

However on Android FORTIFY is now a requirement and future versions will make use of memory tagging on ARM hardware.

So ironically something like Android does have a better sandboxing model as WebAssembly.

Post reply on HN