8 ms·
A 116kb WASM of Blink that lets you run x86_64 Linux binaries in the browser
- moloch-hai 4y agoWe do not deserve Justine. She is proof of divine grace.
- Vogtinator 4y agoThis in particular is a collaborative effort of multiple contributors. See the discussion on https://github.com/jart/blink/issues/8 https://github.com/jart/blink/issues/8 for the emscripten/wasm port.
- jart 4y agoTrung Nguyen and Fabian Vogt are two of the unsung heroes who put a lot of work into helping me get Blink running in the browser. Their support is what made this project successful. You can visit their GitHub profiles here: https://github.com/trungnt2910 https://github.com/trungnt2910 and https://github.com/Vogtinator https://github.com/Vogtinator
- moloch-hai 4y agoWe do not deserve Trung Nguyen and Fabian Vogt.
- deleted 4y ago[deleted]
- cs702 4y agoSoon I'll be able to run my browser on Linux running inside a browser running on Linux running inside a browser running on... More seriously, wow -- this implementation of the Blink x86_64 emulator in WASM really is tiny!
- deleted 4y ago[deleted]
- remexre 4y agoThis is https://github.com/jart/blink https://github.com/jart/blink , not https://chromium.googlesource.com/chromium/src/+/master/third_party/blink/ https://chromium.googlesource.com/chromium/src/+/master/thir... btw
- fnimick 4y agoPretty sure this is the "future" according to https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript https://www.destroyallsoftware.com/talks/the-birth-and-death...
- danuker 4y agoIt's uncanny that we have a war, but he missed the pandemic.
- ilyt 4y agoThe final answer for browser compatibility, just ship the browser version you need with the app.
- teaearlgraycold 4y agoElectron in the browser :D
- flopriore 4y agoSoon we'll be able to remove the OS and directly run the browser /s
- tekknolagi 4y ago@jart, how does the JIT work? Have you done the kind of Wingo-style wasm JIT[^0]? Or do you turn the JIT off? [^0]: https://wingolog.org/archives/2022/08/18/just-in-time-code-generation-within-webassembly https://wingolog.org/archives/2022/08/18/just-in-time-code-g...
- deleted 4y ago[deleted]
- jart 4y agoBlink's JIT only supports x86_64 and aarch64 at the moment. Otherwise it runs in interpreter mode.
- kentonv 4y agoBut to be clear, the JIT can actually target Wasm? Like it generates new Wasm modules on the fly and loads them with the browser's WebAssembly API? EDIT: Nevermind I misread, duh (thought you were refering to the input binary format rather than the target architecture). Still, very cool.
- jart 4y agoThe binary format that Blinkenlights executes is x86_64. The binary format that it generates for the purposes of JIT is x86_64 or aarch64. I'd like to add WASM to the list of JITable formats if it's possible. Currently, only about ~10 lines of handwritten assembly needed to be written per target architecture. Blink also needs a way to generate functions calls, plus an instruction length decoder. I currently know very little about WASM, but if someone else does, I'm hoping I've made it relatively straightforward to contribute JIT support.
- tekknolagi 4y agoThanks!
- nyanpasu64 4y agoOh, this is Blink, a x86/Linux emulator in a browser, not Blink the browser engine on x86/Linux.
- shmatt 4y agoI was hoping this was for Blink, the security system by Amazon
- sgammon 4y agoLove jart’s work
- skybrian 4y agoI believe it's for some Linux binaries, statically compiled. Having a portable subset of Linux is pretty cool though. Maybe this turns into an anti-distro, a collection of portable apps not specific to a Linux distro? (Or Linux, even.)
- westmeal 4y agoHmmm... even if its for statically compiled bins anyway I think this is super neato. Definitely gonna follow the author.
- westurner 4y agoFrom https://github.com/simonw/datasette-lite/issues/26 https://github.com/simonw/datasette-lite/issues/26 : > Micropip or Mambalite or picomamba or Zig. > "Better integration with conda/conda-forge for building packages" [pyodide/pyodide#795]( https://github.com/pyodide/pyodide/issues/795 https://github.com/pyodide/pyodide/issues/795) > Emscripten-forge > Adding packages: https://github.com/emscripten-forge/recipes#adding-packages https://github.com/emscripten-forge/recipes#adding-packages > - https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten https://github.com/emscripten-forge/recipes/tree/main/recipe... > -- emscripten-forge/recipes/blob/main/recipes/recipes_emscripten/picomamba/recipe.yaml: https://github.com/emscripten-forge/recipes/blob/main/recipes/recipes_emscripten/picomamba/recipe.yaml https://github.com/emscripten-forge/recipes/blob/main/recipe... > --- mamba-org/picomamba: https://github.com/mamba-org/picomamba https://github.com/mamba-org/picomamba From emscripten-forge/recipes https://github.com/emscripten-forge/recipes https://github.com/emscripten-forge/recipes : > Build wasm/emscripten packages with conda/mamba/boa. This repository consists of recipes for conda packages for emscripten. Most of the recipes have been ported from pyodide. > While we already have a lot of packages built, this is still a big work in progress.
- DrNosferatu 4y agoIs Justine reading this? - When will your suite of tools support Zig, the language? (or interoperate with the Zig compiler?)
- jart 4y agoJustine here. I'm an avid Hacker News reader. I think Zig is awesome and I'd love for my projects (e.g. Cosmopolitan Libc) to support it. What makes that challenging is Zig doesn't depend on the C library and instead directly talks to the kernel ABIs. The Zig team might be able to add support for building Zig apps on the Cosmopolitan platform, but it's less likely to happen than other languages like Go, where we've already received the green light from the Go team for a GOOS=cosmo port. As for Blinkenlights, if Zig produces a static binary which doesn't assume a 4096 byte page size, then your Zig programs should work in Blink. If that's not the case, email me the logs and/or executable in question, so I can make sure Blink has the features you need. Please note that Zig has had some roadblocks surrounding the system page size https://github.com/jart/blink/issues/14 https://github.com/jart/blink/issues/14
- tomcam 4y ago> we've already received the green light from the Go team for a GOOS=cosmo port. Sweet!
- spiritplumber 4y agoMove Zig for great justice
- jart 4y agoTake off every Zig
- dahfizz 4y agoIs this useful, or just another "I ported X into the browser for fun"?
- jart 4y agoAuthor of Blinkenlights here. I'm a professional amateur so I do everything for fun. I think it's fun to create command line Linux programs. I want to be able to share the programs I've made with other people. The browser provides an environment for running software that's safe and easy. The problem is that most existing solutions for running Linux programs in the browser require emulating the operating system too. So I built a program that implements the x86_64-linux abi, which is very small. That way when myself and others share the programs we've written, they'll load fast and download fast.
- musicale 4y agoTerrific idea. As you note browsers are already a capable platform, so a compact compatibility layer is good way to add support for linux binaries. ABI virtualization really deserves to be more popular as an alternative or complement to containers and VMs. Perhaps it hasn't caught on (besides Proton/WINE) because there isn't a semi-standard format/platform like docker or virtualbox. Haven't multiple people on HN built simple direct GUI libraries that work natively and on wasm? It would be cool for apps and game binaries with (sound, graphics, networking, controller support...) to be portable across linux and web (and probably windows, macos, android, etc.) with a compact compatibility layer.
- jart 4y agoI've currently been focusing on making terminal user interfaces work well across personal computer, server, and browser platforms, because rich ANSI TTYs (like Blinkenlight's TUI) is a problem that's tractable for mostly one individual to solve really well. Doing the same thing with GUIs would require millions of dollars of resources and even then, it'd be unlikely to have a native look and feel.
- 4y ago
- secondcoming 4y agoThis sounds terrible.
- nottorp 4y agoIt works only on x86 browsers i guess?
- vardump 4y agoIt runs on any CPU on any browser that supports WASM.
- pvg 4y agodiscussed a few days ago, 100ish comments https://news.ycombinator.com/item?id=34250352 https://news.ycombinator.com/item?id=34250352
- Kab1r 4y agoAm I correct in thinking networking (TCP/UDP) is impossible to implement without some kind of WebSocket proxy?
- danielheath 4y agoWebRTC lets you send messages point to point, you could tunnel over that, but no, arbitrarily sending packets from inside the users firewall isn’t going to happen.
- josephg 4y agoYou could also open a websocket connection back to a specific host and proxy raw tcp though that. But I wouldn’t be in any hurry to run a public proxy.
- yegor 4y agoI would to be able to run MTR/traceroute with this. Would be a godsend for anycast network troubleshooting with non-techy users.
- danielheath 4y agoRight, but the traceroute would egress via the proxy, not from the users machine, which would be unhelpful. Yes, there's absolutely good uses for being able to issue regular network packets from a browser, but there's also some quite serious misuses, so we can't have it.
- nyolfen 4y agohttps://kirill888.github.io/notes/wireguard-via-websocket/ https://kirill888.github.io/notes/wireguard-via-websocket/
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- londons_explore 4y agoSo can it run wayland so that we can get GUI apps running on an iphone?
- DustinBrett 4y agoI'd love to integrate this into my desktop environment in the browser "OS" (https://github.com/DustinBrett/daedalOS https://github.com/DustinBrett/daedalOS). I already have v86 (https://github.com/copy/v86 https://github.com/copy/v86) for running general x86 iso/bin files and BoxedWine (http://www.boxedwine.org/ http://www.boxedwine.org/) for 16/32 bit exe's. It would be cool to be able to drag and drop a Linux binary and just run it. I tried to do this with box86js (https://github.com/raoofha/box86js https://github.com/raoofha/box86js) but had little luck. Although as a non-Linux user, I am not sure where to get good examples/tests of binaries.
- parkuman 4y agoAny luck so far? After reading through the GitHub discussion it seems like it could be hacked into Daedal, some folks in there had workflows for compiling the wasm binary. Also, big fan of your site and content!
- DustinBrett 4y agoThanks! I actually am just looking into this now. It looks like a lot of progress is being made (https://github.com/jart/blink/issues/8#issuecomment-1383284995 https://github.com/jart/blink/issues/8#issuecomment-13832849...). I will follow this closely and try and integrate something as soon as I see some good demos or a way to get a POC up. Thanks for the support!
- armchairhacker 4y agoComing soon: web browser in an OS emulated in your web browser, to do CORS/XSS/MITM attacks. At 116kb and especially if you add JIT support, with a bloated site you won't even know it's being emulated!
- jwl4fun 4y agoHi, thanks for your sharing. Could you help to elaborate the details about preventing CORS/XSS/MITM attacks in this way?
- armchairhacker 4y agoIt's not really a big advantage over existing attacks. You still need the user to be on a domain controlled by the attacker, so a user will be able to spot that e.g. they're not on their real bank website if they just look at the URL. And there are already attacks which emulate the entire look and feel of a real bank website and you can only spot with a bad URL. The key benefit of this approach is that you can put another website into your website like an iframe, and have full access to the website within your site (including e.g. reading and injecting JavaScript). But your site is still sandboxed, and users still have to be tricked into going to it in the first place. Then they need to be tricked into using the real website, inside the fake website, which at this point many people are smart enough to not do anyways.
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- ksec 4y ago>Coming soon: web browser in an OS emulated in your web browser, That would mean a Nuclear War, most of Silicon Valley to be inside Exclusion Zone, and millions of refugees running for life off the coast of Australia.
- lopkeny12ko 4y agoI can't be the only one reading this and thinking "wow, this sounds terrible," right? This is certainly very cool as a tech demo but why would anyone want the websites of tomorrow to be delivered as opaque ELF binaries, running via emulation, in a virtual machine inside my browser? This sounds absolutely insane to me. It was already bad enough when websites started shipping giant, obfuscated Javascript bundles circa 2010. Now we're enabling running arbitrary x86 binaries for websites and no one bats an eye?
- tusharsadhwani 4y agoIf you think about it it's no different than wasm already. And wasm has been accessible for at least 4 years now, and yet nobody has given up react and typescript. wasm is being used to do compute heavy work efficiently, and giving that data back to js. and this will allow doing that but with the 60 or so years of unix programs that already exist. code reuse to the highest extent. how cool is that?
- deleted 4y ago[deleted]
- memalign 4y agoVery cool project! Justine, how can I learn more about how disk access (reading/writing files) works? Is there a blank virtual disk of some kind in memory? (Ohh I’m realizing maybe this is provided by emscripten?) Does stdio work? Would it be possible for ncurses to work?
- theanonymousone 4y agoDoes that work for GUI software too (or is that in the plan? This means that we don't need to recompile the source to a wasm target to run it in the browser, no?
- nikivi 4y agoReminded me of https://browsix.org https://browsix.org
- mikewarot 4y agoAll that's needed is a way to feed a single file/folder to the executable and you've fixed computer security by giving us N2E {Need(ed) To Execute} security.