News for hackers. Stuff that matters.
Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by lostmsu on Tuesday July 28, 2020 @03:18AM (#23973176)
This is a really cool concept. I'd love a mature supported technology, that could replace .NET's AppDomain.
Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by pjmlp on Tuesday July 28, 2020 @03:39AM (#23973320)
WebAssembly is anything but mature, and given that .NET also supports C++ from the get go, I would be curious to have a security analysis in how much "secure" WebAssembly actually is.

Thankfully researchers have finally started assessing it, with the first wave of papers reaching USENIX 2020.

Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by azakai on Tuesday July 28, 2020 @01:31PM (#23978388)
That feels a little unfair.

WebAssembly has been shipping in the majority of production browsers for over three years now. That's one of the most security-sensitive attack targets that exists. Those browsers would not have done so if it weren't reasonably safe.

Of course there are vulnerabilities that are discovered, just like in every part of the web platform. Nothing is perfect. But a huge amount of attention has been put on wasm's security and the major implementations are very robust.

It's true that wasm is reaching into other areas besides the web, which does raise new questions (like in that recent USENIX 2020 paper). Perhaps it's fair to say wasm is immature as a replacement for a native executable, or other new ideas that are coming out. But it's very mature as a sandboxing solution for pure computational code, and it's used successfully on the web all the time.

Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by pjmlp on Tuesday July 28, 2020 @02:10PM (#23978883)
It not unfair when plenty of WebAssembly supporters try to sell it as the ultimate bytecode, without any flaws from all the ones that came into existence since the 60's.

Also it is still catching up to features that those bytecodes already have during the last 20 years.

Those browsers are only shipping MVP 1.0, unless you want to equate Web with Chrome.

Only now are hackers and security researchers actually caring about WebAssembly security, hence the first wave of security papers on USENIX 2020.

I expect those that drove WebAssembly in detriment of what we already had to be eventually surprised.

For what I care, I will just take advantage of it to get back my plugins.

Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by merb on Tuesday July 28, 2020 @04:17AM (#23973547)
biggest problem is that .net/dotnet core can not be easily wasm aot compiled. currently you compile the runtime to wasm and use the dll with the wasm runtime. this is the approach that blazor wasm uses and it is aweful.
Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by pjmlp on Tuesday July 28, 2020 @04:29AM (#23973617)
<win-dev-rant-mode>

Mostly because Microsoft currently doesn't not know what they want, check the feedback regarding the missing roadmap for CoreRT/.NET Native.

With Reunion, MAUI, Blazor (WebAssembly and mobile), WPF team transfer, they seem to have got back into another reboot the eco-system phase.

</win-dev-rant-mode>

Now given that, with Unity's .NET flavour can be compiled via IL2CPP => WebAssembly, or with Mono AOT as in Uno.

Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by ckok on Tuesday July 28, 2020 @05:23AM (#23973920)
I tried this. Aot compiling with the .net runtime just isn't very practical. I know mono does this, with some guided info for reflection based classes. But the way the structure is setup, is that string pulls in globalization. And enumeration. And comparable and equality which both work by reflection to pick the right default implementation. Reflection is expected to work, which pulls in all methods and their dependencies. By the time you have a working executable for hello world, you're a few MB ahead. The class library just isn't setup for this kind of use.
Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by GordonS on Tuesday July 28, 2020 @07:05AM (#23974444)
I was thinking about this just the other day, when Microsoft announced the latest dotnet 5 preview, and yet again have postponed AOT - Microsoft have been teasing dotnet devs with the promise of production-ready AOT for something like a decade.

Frankly, I wish they'd put up or shut up - either prioritise it and make it happen, or just admit defeat and say it's not going to happen.

Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by kevingadd on Tuesday July 28, 2020 @09:23AM (#23975458)
It's not really a matter of prioritization. The current WASM platform and toolchain are missing features necessary for AOT-compiling things like .NET executables. For one example, exception filters ... and unfortunately the standard library uses them, not to mention end-user software.

To provide more detail: Exception filters require the ability to stackwalk and search for filters and run them before actually handling the exception. WASM has no stack-walking functionality whatsoever (this also means getting and introspecting stack traces is currently impossible), so searching for filters is already a non-starter. You can try and emulate this through a normal unwind-only exception flow, but you have to rewrite all your application code to insert lots of checks and flow control changes in order to do it, and it's still observably different.

I've spent months just working on fixing this problem, and it's one of the things that wasm AOT is going to need before it can ship.

WASM is a generally weak target platform. A great 1.0, to be sure, but unless your goal is to run posix C code you're going to hit snags. When we were designing WebAssembly to begin with it was an intentional decision for 1.0 to be limited in feature set with the goal of improving it later - a Minimum Viable Product.

Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by GordonS on Tuesday July 28, 2020 @09:29AM (#23975520)
Sorry for any confusion caused on my part - my gripe wasn't with compilation to WASM, but about AOT to native bytecode.
Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by kevingadd on Tuesday July 28, 2020 @09:30AM (#23975529)
Exception filters are also a problem for AOT to non-WASM LLVM targets, for similar reasons - expressing complex exception handling and flow control in LLVM is very difficult. But the situation is better there, at least.
Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by pjmlp on Tuesday July 28, 2020 @07:48AM (#23974720)
Production ready AOT for .NET exists since Singularity, which MIDL and Bartok compilers were the basis of .NET WinRT on Windows 8/8.x.

Then some of the Midori tech eventually made its way into .NET Native, which from my point of view UWP + .NET Native is what .NET should have been all about back in 2001.

Apparently after the timid attempt with XAML Islands and MSIX, they seem to be getting the house in order and driving the platform into a way to pretend that Windows 8 and 8.1 never happened, but it seems to be lacking a lot of coordination and long term planning.

Windows 10X apparently is also not getting Win32 sandbox any longer, this assuming it ever gets released.

Still in the middle of the chaos, it still feels much better than if I had to deal with Android on daily basis, one IO best practices is next years legacy.

Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by GordonS on Tuesday July 28, 2020 @09:02AM (#23975244)
I guess you know this, but what I really meant was AOT for any dotnet apps - not specifically for UWP or whatever sandboxed, designed for touchscreen thing Microsoft is trying to push.

What many have been waiting for is the ability to AOT for both Windows and Linux.

I recall Mono had something like this around 10 years back, but it was a bit flakey. Not sure if that still exists in some form.

Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by pjmlp on Tuesday July 28, 2020 @09:12AM (#23975350)
Mono keeps it around given that is how Xamarin iOS works, and also available as option for Xamarin Android (by default it uses JIT).
Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by kevingadd on Tuesday July 28, 2020 @09:28AM (#23975495)
I think when someone says "production ready AOT" in any context, it's never quite obvious what they mean. As ckok implied, even when AOT is "working" it may generate a 100mb executable. For some end users that is production ready (like Facebook, who reportedly were shipping 1gb+ AOT'd php executables to their server cluster) and for other end users it is not (because a 100mb browser app is a closed tab.)

WASM now and emscripten before it both were designed and optimized for POSIX C apps and for games, and they're pretty good for those scenarios. Larger-scale stuff is pretty tricky and the tooling ecosystem will have to continue to grow to support more real-world applications. JIT, stackwalking, GC, etc are all still not there on WASM - thankfully threading is finally crossing the finish line but even that has taken years.

Re:WasmBoxC: Simple, Fast, and VM-Less Sandboxing by pjmlp on Tuesday July 28, 2020 @10:00AM (#23975848)
Some day WebAssembly will match what Flash CrossBridge and PNacl already had 10 years ago.