Live data from Hacker News

PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM

leaningtech.com

41–50 of 111 posts

Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM

#41
post #33
post #28

Earlier quoted context omitted.

It can still be exploited the Applets/Flash way, by forcing the internal memory to become corrupted and with it change its behaviour.

It literally cannot.

Assuming the VM can't be exploited/escaped somehow, which would be a first.

Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM

#42
post #31

Nice work. I love simple and "conservative brute force" techniques like this--brute force in that you run all the example call sites in the interpreter, conservative in that it bails out when things get hard (e.g. bail out if a single basic block is executed too many times). I am wondering if this technique could be hybridized with abstract interpretation or partial evaluation, which are known techniques in compilers…

The step forward that I believe worked well here is that given some actual paths (and since they are simply a sequence of Instruction, they can be fed to an interpreter) they are merged or forked while entering or exiting SCCs, this allows to keep a low count of actual visit but exploring a big enough set of path to prove that it covers all possible executions.

On the second part, I have to do some thinking and coming back, thanks!

Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM

#43
post #26

Earlier quoted context omitted.

This sounds like ActiveX. Security issues related to ActiveX are solved or not? Because if they are not, then it's just a reskin of ActiveX and malware authors gonna have a field day.

That is the thing with fake security advertising of WebAssembly. You can just as easily compile heartbleed into WebAssembly and call it a day. Yes it is sandboxed, but hardly any different than running an OS process with sandboxing lock down regarding which OS syscalls are allowed. Think it this way, just because an OS container cannot exploit its host (minus hypervisor bugs), that doesn't mean that what is inside is…

You keep repeating this, but it's simply not true.

The syscall surface is zero by default. WASI of course expands that by a lot, but sane WASI implementations require restrictive whitelisting of available resources like specific files or directories that can be accessed. (wasmtime-wasi does this well,for example). The whole wasi spec is aiming for capability based security, including things like only providing access to pre-opened sockets.

All production deployments of server side Wasm I have seen have very tight scoping.

Sandboxing on Linux, in contrast, is a complicated mess, with a myriad of partial and leaky solutions (SELinux, Apparmor, Docker, Snap, Flatpak, ...) .

Having a good cross platform toolkit is completely out of reach.

The only OS that has comparable sandboxing that is practical is Fuchsia.

Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM

#44
post #30
post #15

Earlier quoted context omitted.

WebAssembly implies static linking (malloc / printf & all are part of the shipped module) and code size matters since it directly influence users (since there might be delays in downloading big payloads). Both factors plays a role in deciding to plan putting work in optimizations like this. There are some general gains to be had with this optimization, and probably the same ideas were already around for a while, but…

Not necessarily, shared libraries are on the WebAssembly roadmap.

Yes, I wanted to be more nuanced but oversimplified. Thanks for mentioning this!

Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM

#45
post #26

Earlier quoted context omitted.

That is the thing with fake security advertising of WebAssembly. You can just as easily compile heartbleed into WebAssembly and call it a day. Yes it is sandboxed, but hardly any different than running an OS process with sandboxing lock down regarding which OS syscalls are allowed. Think it this way, just because an OS container cannot exploit its host (minus hypervisor bugs), that doesn't mean that what is inside is…

You keep repeating this, but it's simply not true. The syscall surface is zero by default. WASI of course expands that by a lot, but sane WASI implementations require restrictive whitelisting of available resources like specific files or directories that can be accessed. (wasmtime-wasi does this well,for example). The whole wasi spec is aiming for capability based security, including things like only providing access…

And will keep repeating ad eternum given the fake security sales from Webassembly, for God's sake evem the standard has a security section mentioning possible issues not addressed.

There is no magic in WASM, only when the only thing it does is warming up a CPU.

Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM

#46
post #7

Optimizations like this are incredible to me. In my compiler class in college, I was smitten by how different optimizations were performed, and we only ever worked with pretty basic constant propagation and dead code elimination. The work here is incredible. My respect to the entire team.

> My respect to the entire team.

Same!

Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM

#47
post #9

This company has an x86-to-WASM compiler that lets you execute arbitrary binaries in the browser. Also a JVM to WASM transpiler. There's a fantastic Meetup presentation given by one of them where they show running a C++ multiplayer game with both client AND server running in a browser, using WebRTC as a networking polyfill. Really mindblowing: https://youtu.be/7JUs4c99-mo?t=167

> running a C++ multiplayer game with both client AND server running in a browser, using WebRTC as a networking polyfill Ok, now you have my attention. Been waiting for that possibility for a while!

If you are interested, here is the article I wrote about that particular project: https://medium.com/leaningtech/porting-a-c-multiplayer-game-...

Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM

#48
post #9

This company has an x86-to-WASM compiler that lets you execute arbitrary binaries in the browser. Also a JVM to WASM transpiler. There's a fantastic Meetup presentation given by one of them where they show running a C++ multiplayer game with both client AND server running in a browser, using WebRTC as a networking polyfill. Really mindblowing: https://youtu.be/7JUs4c99-mo?t=167

What would the impact be on battery life compared to native execution? Can one get it just as power efficient as native execution, only slower? For computationally less intensive applications browser portability might be an excellent tradeoff. It gives a new meaning to the slogan "write once, run everywhere".

Generally things that run faster are more power efficient, because the CPU has to run for less time to do the same work. There might be a few odd exceptions here and there, e.g. certain AVX instructions can use a lot of power, but they're not common.

Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM

#49
post #17
post #9

This company has an x86-to-WASM compiler that lets you execute arbitrary binaries in the browser. Also a JVM to WASM transpiler. There's a fantastic Meetup presentation given by one of them where they show running a C++ multiplayer game with both client AND server running in a browser, using WebRTC as a networking polyfill. Really mindblowing: https://youtu.be/7JUs4c99-mo?t=167

At what point does the browser become an "os", what's next? Chrome hypervisor?

> At what point does the browser become an "os", what's next?

When it no longer requires an OS to run.

Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM

#50
post #45

Earlier quoted context omitted.

You keep repeating this, but it's simply not true. The syscall surface is zero by default. WASI of course expands that by a lot, but sane WASI implementations require restrictive whitelisting of available resources like specific files or directories that can be accessed. (wasmtime-wasi does this well,for example). The whole wasi spec is aiming for capability based security, including things like only providing access…

And will keep repeating ad eternum given the fake security sales from Webassembly, for God's sake evem the standard has a security section mentioning possible issues not addressed. There is no magic in WASM, only when the only thing it does is warming up a CPU.

I'm happy to have a technical discussion, but your comments always stop at "Wasm bad", without countering the arguments.
Post reply on HN