News for hackers. Stuff that matters.
Re:Make CPython segfault in 5 lines of code by Thaxll on Wednesday December 18, 2019 @11:20PM (#21831982)
Segfault inside the runtime, What does it means exactly? A segfault is by definition at the OS level.

WebAssembly koolaid is strong on HN, let's wait the first exploits that escapes the runtime to assess the "fully-safe" architecture.

Re:Make CPython segfault in 5 lines of code by wizzwizz4 on Thursday December 19, 2019 @09:03AM (#21834937)
I think they're trying to say that an out of bounds memory access within the emulated WebAssembly machine can be caught by the WebAssembly runtime. (I don't know whether this is true; I hardly know anything about WebAssembly.)

The way they said it, though, makes it sound like WebAssembly is implemented with full process sandboxing or something, which is patently false. It works that way in neither Chrome nor Firefox, and there are no other browsers right now.

Re:Make CPython segfault in 5 lines of code by rini17 on Thursday December 19, 2019 @03:34PM (#21838955)
WebAssembly follows the unfortunate C paradigm that no checks are done at runtime, only these that programmer requests explicitly (and only if no undefined behavior is involved), to improve speed.

The WASM sandbox can call only set of specified host functions, but I expect so much functionality snowballing inside sandboxes that we'll have to allow everything including unsafe ones, anyway.

Re:Make CPython segfault in 5 lines of code by Dylan16807 on Thursday December 19, 2019 @05:12PM (#21839837)
WebAssembly uses 32 bit indexes to access memory. The default way of implementing memory safety for it is to put a few gigabytes of dead address space before and after the memory a WASM program uses. This makes it impossible for the memory access instructions to escape, despite having no runtime checks.

So it can segfault all the way up to the machine level. But more importantly, it's safe for it to 'segfault' out of its allocated memory, because it can't reach any other memory with 32 bit numbers.

Re:Make CPython segfault in 5 lines of code by rini17 on Friday December 20, 2019 @07:03AM (#21843507)
This is nothing new, memory space of a process in all modern OSes is protected so that segfaults are safe too. Combined with original UNIX idea of small tools that communicate by pipes it was fine.

But now the processes are behemoths with gigabytes of dynamically linked libraries that are too hard to secure and to restrict system access, we just enable everything. This will happen to wasm. I'm sure there are WASM blobs configured with unfettered access to DOM in the wild already.

Re:Make CPython segfault in 5 lines of code by Dylan16807 on Friday December 20, 2019 @05:24PM (#21847919)
> This is nothing new, memory space of a process in all modern OSes is protected so that segfaults are safe too.

Right, but look at what I'm replying to.

"The way they said it, though, makes it sound like WebAssembly is implemented with full process sandboxing or something, which is patently false."

Unlike with Javascript, the program hosting a WASM script is immune to corrupt pointers inside the script. That's equivalent to OS-level isolation, which is pretty good!

> But now the processes are behemoths with gigabytes of dynamically linked libraries that are too hard to secure and to restrict system access, we just enable everything. This will happen to wasm. I'm sure there are WASM blobs configured with unfettered access to DOM in the wild already.

There will inevitably be bugs in the code handling the html/css/dom/rendering. But WASM greatly reduces the attack surface of the scripting VM.

The types of bugs most likely to still exist with WASM are the types where isolating it in a separate process that communicates by pipes wouldn't help.