Annotated article: https://smort.io/5e621c00-3c95-4807-b0be-488947a34d8a For the first image to render correctly, please change the theme to light mode
PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM
71–80 of 111 posts
Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM
#72Earlier quoted context omitted.
> It _cannot_ access your system even if it tried. That’s the intent, at least. I’m sure we’ll get to see exploits that manage to do exactly this.
Perhaps, but if so, that would be a bug in the browser’s WebAssembly implementation, not CheerpX.
But rowhammer is still a thing.
There's a whole stack of abstractions, that all _may be_ vulnerable. I'm sure CheerpX is very good, but there's no way to _know_ that all the dependencies from the toolchain used to build all the way down to the running environment is actually bug free.
As a first line of investigation, I'd suspect cheerpX, just because so many eyes look at browser sandboxes. _shrug_ your milage may vary.
Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM
#73Annotated article: https://smort.io/5e621c00-3c95-4807-b0be-488947a34d8a For the first image to render correctly, please change the theme to light mode
So you highlighted a few sentences? What's the point, other than advertising your project?
Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM
#74> You might have heard of dead-code elimination, an LLVM optimization pass that removes code proven as unreachable. I was actually interested in less-obvious situations. In particular blocks that are reachable on the control flow graph, but not when consider wider execution invariants.
I've got a trivial example here: https://gcc.godbolt.org/z/7EnPG5WM6 noinline is added to foo to demonstrate Clang is actually changing the number of arguments foo takes, and its inlined the arguments from bar and baz.
> Can we use information on the call-sites and the corresponding format strings to prove that some code paths, for example formatting for floating point numbers, are actually never taken?
Seems to already have that effect in Clang. Using Emscripten 3.1.3, compiling 2 different main's with just
printf("Hello world %d\n", argc);
And printf("Hello world %d %f\n", argc, volatileFloatArg);
For the single int arg, the top 3 symbols by size are 47.7% 2.65Ki -NAN(IND)% 0 printf_core
7.4% 421 -NAN(IND)% 0 [section Data]
6.6% 375 -NAN(IND)% 0 main
And for the one that added a float arg, 34.5% 3.04Ki -NAN(IND)% 0 fmt_fp
28.8% 2.54Ki -NAN(IND)% 0 printf_core
5.1% 464 -NAN(IND)% 0 [section Data]
So when a float argument wasn't passed into printf, it did not include fmt_fp, a delegate that handles floating point for printfOne issue that can complicate this analysis is linking multiple libraries that reference standard library (or functions in other libraries). If you're linking together object code, without more IR context, LLVM is going to have to be more conservative. So I think if you link in a WASM object code file that references printf, it won't be able to perform all the IPO that will allow it to trim the CFG.
Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM
#75Have you guys looked the literature of supercompilation? This seems to be a special case of it.
All analytical solutions to optimization problems can be seen as special cases of the brute force search I guess. But SC is impractically slow for anything except a few instructions long sequences. edit: actually I was thinking of superoptimizers, I guess it's a different concept.
Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM
#76Earlier quoted context omitted.
Perhaps, but if so, that would be a bug in the browser’s WebAssembly implementation, not CheerpX.
CheerpX looks amazing. Not blaming that project it in any way. But rowhammer is still a thing. There's a whole stack of abstractions, that all _may be_ vulnerable. I'm sure CheerpX is very good, but there's no way to _know_ that all the dependencies from the toolchain used to build all the way down to the running environment is actually bug free. As a first line of investigation, I'd suspect cheerpX, just because so…
Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM
#77This looks great! Please consider upstreaming this into LLVM; it would benefit many other users of LLVM. I'd love to see this used in Rust, for instance. What kind of compilation performance do you see for how long this pass takes? Do you apply this to all functions, or to all functions with certain properties, or to functions tagged some particular way?
Thanks a lot! I also believe it would be cool to upstream this, we will have to sit down and do some planning. Compilation time could improve (I was actually working on this today), but it's already in line with other optimizations, taking Currently it's applied to all functions, since runtime it's anyhow somehow linear in the number of Instructions a Function has, but possibly in more costly versions of this (that w…
Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM
#78I would naively expect that for most functions you know too little about their arguments or the state in which they will be executed to be able to tell that certain branches will definitely not be taken. Especially since any function that has some mildly interesting side-effects (like loading and storing from a pointer or a class/struct field, or even _calling into any function that does that_) would seem to foil the analysis and turn large chunks of code into "unknown reachability".
Rephrasing, I would expect the set of basic blocks that can be removed just by essentially repeated constant propagation of statically-known function arguments to be pretty small. But I would be happy to be proved wrong if that intuition is not right.
Printf is somewhat of an exception, since the format strings are usually known at compile time, meaning that a lot of the control flow can indeed be deduced by compile-time evaluation, but for most functions I would not expect that.
Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM
#79Earlier quoted context omitted.
CheerpX looks amazing. Not blaming that project it in any way. But rowhammer is still a thing. There's a whole stack of abstractions, that all _may be_ vulnerable. I'm sure CheerpX is very good, but there's no way to _know_ that all the dependencies from the toolchain used to build all the way down to the running environment is actually bug free. As a first line of investigation, I'd suspect cheerpX, just because so…
You can Rowhammer from JavaScript already, so this really has nothing to do with CheerpX.
I don't know how to prove the absence of a thing. I can only prove existence.
I was trying to highlight that every layer of abstraction has vulnerabilities all the way down to the hardware level.
I'm perfectly willing to accept that CheerpX has no known vulnerabilities.
Re: PartialExecuter: Reducing WebAssembly size by exploring all executions in LLVM
#80Earlier quoted context omitted.
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.
Also, how does wasm relate to traditional sandboxes that “just” hijack system calls? Is there a difference?