Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Qemu.js – a proof-of-concept port of QEMU to web browser using WASM JIT (2019) (github.com/atrosinenko)
138 points by mepian on April 17, 2023 | hide | past | favorite | 28 comments


Gary Bernhardt's hilarious predictions [1] are truly becoming closer to completion.

[1] https://www.destroyallsoftware.com/talks/the-birth-and-death...


Mindblown that we built the Web on this...

xs = ['10','10','10']

(3) ['10', '10', '10']

xs.map(parseInt)

(3) [10, NaN, 2]


For those who may be baffled at the result, it comes from parseInt accepting two arguments (string & radix), and map providing three per iteration (the value, index and whole array).

The whole array is omitted, but the radix passed to parseInt is respectively 0, 1 and 2.

Valid radix values are 2 to 36, but somehow 0 is also accepted due to its falsiness, and defaults to base 10. Base 1 is definitely not valid so NaNs out, and 10 in base 2 (binary) is 2.

For more of those WTF moments, in JavaScript and other languages, check out "Wat" [1], another hilarious lightning talk by Gary Bernhardt.

[1] https://www.destroyallsoftware.com/talks/wat


Thanks for sharing, was a really nice watch!


Reminds me of https://bellard.org/jslinux/ (which is linked in the Readme of this project too, and IIRC also is qemu+emscripten)

That demo also felt quite crazy back in the day, it even had an option for Win2k!


As far as I remember, JSLinux is mostly written from scratch and only uses some pieces of QEMU. It has no JIT, unlike this project.


Fabrice Bellard is also the original author of QEMU.


Yeah, this is probably right (It's been a long time since I've played with it)

Looks like jslinux is based on TEMU which looks to be a "lite" QEMU.


Lol, maybe Fabrice Bellard is the only "true" full stack programmer in existence....


The 1000x programmer myth is real !!!


Epic joke.


This is incredible. Is there any way to use this directly from an encrypted img file on some remote computer (e.g. dropbox url)? It seems that 'network block devices' might help in that area, but it's unclear. Would be neat for industry to have a e2ee repo of many computers that can be streamed encrypted to a browser for working in.


You could do that running this as a custom app in Peergos [0], and the drive image would just be another file:

https://book.peergos.org/features/apps.html

We've done that for doom using another js emulator (jsdosbox):

https://github.com/Peergos/example-apps#doom-shareware-runni...

[0] https://peergos.net


There's also "jslinux" from Fabrice Bellard himself from a while ago which reused parts of QEMU: https://bellard.org/jslinux/


The demo, based on an older version: https://atrosinenko.github.io/qemujs-demo/

Two articles about the project in Russian (Google Translate is helpful):

https://habr.com/en/articles/315770/

https://habr.com/en/articles/451306/


> This rewrite is still even more work-in-progress than the original one and still does not support block devices.

Unfortunate (if understandable; none of this is criticism!). What does it do for disk, then? Or is it early enough to just not solve that and only use a bare kernel+initrd?


Would it be possible to translate machine code directly to WASM? Probably somebody already dunnit.



This is amazing.

The implications of this will result in some very interesting restrictions in corporate networks.


> The implications of this will result in some very interesting restrictions in corporate networks.

Why? Browsers are already capable of running arbitrary code


Browser-in-browser phishing is already trending


For those who are new to this, the classic article on this kind of phishing is The Line of Death [0]. Basically, the phishing site can create false title and URL bars.

[0] https://textslashplain.com/2017/01/14/the-line-of-death/


This looks like it should not be lost among all the AI news this year.


It's from 2019.


Fair.

Has the power inside of web browsers, and the CPUs powering them, and the models they could power in browser increased?


Love it does the -nic option use WebRTC?


(2019)


Added. Thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: