Blink virtual machine now supports running GUI programs
twitter.com
twitter.com
Maybe you build proton and have any windows game (or software?) in the browser?
[1] https://github.com/jart/cosmopolitan/blob/master/libc/fmt/vc... [2] https://github.com/jart/cosmopolitan/issues/456
A 116kb WASM of Blink that lets you run x86_64 Linux binaries in the browser - https://news.ycombinator.com/item?id=34367767 - Jan 2023 (69 comments)
Emulating an emulator inside itself. Meet Blink - https://news.ycombinator.com/item?id=34250352 - Jan 2023 (107 comments)
Where this talks of running GUI programs, I presume it means that the VM can act as an X client. You would thus still need an X server. I don’t know what may exist along those lines for the web. As for native/desktop hosts, well, I hope you weren’t ever trying to use emulation as any form of security, because the likes of Xorg really aren’t designed for that use case.
I played with this before, and I could use X11 within a mlterm terminal.
I should try to recompile it with cosmopolitan to have a single X server binary both for Windows and Linux
With that and a X server using sixels, there would no longer be a need for something as complex as wslg for most apps: you could just export DISPLAY in your .bashrc, then use one Windows Terminal tab to start X apps, and the other one to display/interact with them.
The change here is implementing sendmsg and recvmsg: socket communications, implying communicating with something outside the VM, which in the context of GUI stuff almost certainly means an X server from outside.
Bullshit. Would be nice if people were to stop spreading these outright lies.
This is not true! Both the protocol and the implementation allow for significant separation of server permissions (for example, notice the difference between ssh -X and ssh -Y), and the peer-to-peer nature of things like clipboard means it is quite easy to deny requests on an application level if they're written for it.
https://www.x.org/wiki/Development/X12/
> In short, X11 was designed for a different era of computing.
> This is not to say that there's an X12 project. There isn't. But if one day there is...
> Systems need to be secure. X12 needs to be designed with security in mind.
Do you think the Xorg devs are spreading lies about Xorg?
Some are, yes, this is incontrovertibly true. But this one? You should hit the "history" button that's in the corner of every wiki. That page hasn't been edited at all since 2013, imported from some other document written I don't know when, and literally the only thing it actually says about security is that "needs to be designed with security in mind".
What does that mean? What specific shortcomings have they identified?
By design Xorg has no isolation between clients so they can all read each others input, control others windows, and inject keystrokes into other applications. That’s unacceptable in the modern age and makes any attempt at sandboxing or separation of privileges for GUI applications completely pointless.
This "hole" doesn't exist. For an X client to capture input, it must be authenticated by either the unix user permission or by an access control list (where the default is to deny). Individual clients can also be marked untrusted which sandboxes them to some extent (though not as much as using a separate X server of course).
I'll grant that in practice, most the time these restrictions are very lax... in part because they can break some applications. But at the same time, in practice, it doesn't seem to matter that much since either you're running things you trust anyway or if a malicious application has access to your X connection they also have access to all your other files so you're in trouble anyway.
>A pathway to a blazingly fast WSL?
I use Haskell for my ever continuing self-education and compiling and linking times with ghc under WSL2 is at least twice as slow as the same operations under native Linux on a much less capable machine.
It is not just me, it is acknowledged WSL2 is very slow in I/O: https://www.phoronix.com/review/windows10-okt-wsl/2
I use WSL2 for reasons but I think I will be much better off with Linux.
I remember no questions being asked when I set up WSL2.
I really doubt that WSL2 will be at native speed with the Linux file system, because reads and writes still have to go through Windows kernel to be mapped into actual hardware reads/writes.
No, Linux is running alongside Windows, not under it. Windows itself is virtualized when WSL2 is turned on, and both Linux and Windows run under Hyper-V. It's quite fancy actually.
Is there documentation/explainer for this? I've been trying to understand more about this (was this a change in Windows 11? Is it only when WSL2 is installed?) for a while now, but not found anything apart from stray HN comments every now and then.
That Windows is then running virtualized is just how Hyper-V works, as soon as you turn on Hyper-V the host Windows runs as a guest in Hyper-V, though with special privileges [1]
https://learn.microsoft.com/en-us/virtualization/hyper-v-on-...
WSL1 is not an NT subsystem, either. WSU (the POSIX subsystem) was an actual NT subsystem, but with WSL, they abandoned this concept and went with a different design for performance reasons.
This is still a problem with WSL2, at least on my WSL2 with Windows file system mappings.
I tried to use instructions that use fossil from the hctree page: https://sqlite.org/hctree/doc/hctree/doc/hctree/index.html
Fossil employs sqlite to store SCM information and it fails with "SQLITE_IOERR(1290): os_unix.c:39533: (22) fsync(...)" error, which is the same with VirtualBox: https://www.fossil-scm.org/forum/forumpost/7fb6c96d80?t=c
So WSL2, having to put up with Windows quirks, is not much a Linux anymore. It is slow and some programs can't even run.
But if WSL2 is given its own drive to mount and do what it wants with it, the issue should disappear.
And when WSL2 supports passing partitions, the issue will vanish.
https://en.m.wikipedia.org/wiki/Hypervisor#Classification
https://learn.microsoft.com/en-us/windows-server/administrat...
If the (WSL) path to your project is inside ~/ it's on the linux file system. If it's in /mnt/c/ it's in the Windows filesystem. In WSL1 those were about equally fast, both going throught the windows kernel. With WSL2, accessing /mnt/c/ from Linux has to go through Windows, and accessing \\wsl$ from Windows has to go through Linux, so where you put the files decides where they are fast.
Yes, WSL1 was great. I hope it will never be sunset, as I need good IO performance.
> where you put the files decides where they are fast.
I also also hope we'll eventually get an option to pass partitions to HyperV, which is currently possible only with full disks.
It would be a return to the previous WSL1 level of performance for files within a NTFS partition: even if you'd need a separate NTFS partition, that'd be a minor nuisance to guarantee performance.
I had the same doubts, but when I finally took the time to install it, I found out that I was wrong. One Java program that I use, which is very heavy on the filesystem and slow like hell under Windows it a LOT faster under WSL2.
As Java profiler support is poor on Windows, I now use WSL2 to run async-profiler sessions and get results as accurate as on native Linux.
EDIT to add: you really have to run things fully in the WSL2 filesystem, be it for compiling or using a program. The performance is awful if you run WSL2 processes under the Windows filesystem.
NTFS is awful at doing lots of small accesses on very small files, at least compared to Ext4. Add to that the fact that if you're on WSL, it needs to write POSIX attributes (which NTFS has no support for and therefore WSL must emulate), and that's a recipe for builds being slowed massively by IO.
As for Defender, well, Defender sees new files and halts everything while it scans them. You can see how that can be a problem for a process that pops out tens of thousands of temporary files, which it will all go and scan, locking them while it does so.
With ntfs3 (kernel 6) this is no longer true, as can be seen for example in Arch install living next to windows on C:\ https://gist.github.com/motorailgun/cc2c573f253d0893f429a165...
Also NTFS has had POSIX attributes support - they just weren't used before.
WSL1 doesn't support POSIX attributes, just like ntfs-3g didn't support them, but it's not a limitation of NTFS.
What do you find that VirtualBox does better than Hyper-V?
If you need good IO performance, WSL1 is still a valid option.
I need good IO performance, and it's not clear how much of the overhead is due to NTFS, and how much is due to 9p (to pass the VHDX file on the NTFS partition to WSL2)
So I'm planning some experiments with OpenZFS for windows and NTFS3 (https://old.reddit.com/r/zfs/comments/10lcnpk/zfs_raw_passth...), first using a WSL2 kernel with the option enabled (https://github.com/microsoft/WSL/issues/8564 and https://github.com/bioluks/WSL2-Linux-Kernel-NTFS) then WSL1.
I have a dual NVMe setup and W11 for Workstations, so it should be possible to run a passthrough of both partitions to the kernel.
However, it's not clear yet how to do that with a VHD on VHDX: most of the documentation I've read about VHD (or VHDX) refers to a passthrough as an "old" option: https://www.altaro.com/hyper-v/hyper-v-pass-through-disks/
As the computer has 2x NVMe and 2x GPU, it should be easy to do a GPU passthrough (with one GPU for Linux native, the other in passthough to Windows) but this brings a little extra complexity I'd rather avoid if I can.
> They are both impacted by storage overhead
If you're accessing files through SMB or something then sure, it'll be slow.
[0]: https://github.com/jart/blink/pull/46#pullrequestreview-1264...
~/blink$ pledge.com -v/lib -v/bin/ls -v. -p 'stdio rpath tty prot_exec' o//blink/blink /bin/ls
HTAGS LICENSE Makefile README.md TAGS blink build o test third_party tool
You can now be certain that your `ls` command isn't spying on you or uploading your bitcoin wallet to the cloud. The blink command itself is currently unsecured. However that shouldn't matter, since we can compose blink with pledge.com to bolt on all the security we need separately!https://github.com/XQuartz/XQuartz/issues/91
Besides that, even Linux is slowly moving to Wayland.
https://github.com/owl-compositor/owl
It still lacks a lot of features though (I think, I never tried it out)
Damn, I don't do enough things
So... at least you haven't done that :)
She also claimed to have written hacks for Kevin Mitnick.
Justine was somewhat controversial inside the Occupy movement, she was outside most circles and was criticized for extremely strongly-voiced technocratic opinions (see "Nerds Should be Segregated" [2], since deleted), but she's incredibly, incredibly talented. A good profile of Justine x Occupy post-mortem is here [3]
[2] https://web.archive.org/web/20141102140507/https://justinetu...
[3] https://www.thenation.com/article/archive/breaking-occupy/
Someone should write some kind of historical explanation of how this could have happened. And how critical is it for the "APE" scheme to work? Could APE binaries work on AROS x86_64 for instance? (Without emulation.)
I also find it surreal that it took this long for someone to do something like Actually Portable Executable. I mean, it's slick and easy to use, but I haven't even seem assembler demos of this.
Is the same polyglot EXE possible also on 32-bit x86? If so, I find it even weirder this have not been done long ago, considering the strange hacks people have pulled over the years.
I'm fascinated by the whole thing, as you can tell. Back in the day, Windows and Unix seemed so far from each other, like oil and water.
These are simply the operating systems I knew best, because I grew up using them, and as a result was able to discover the right combination of tricks to get it to work. I'm sure someone else who loves AROS and knows AROS would also be able to discover a way to trick it out so that APE could support it too. Same goes for other platforms. For example, one of the things on my TODO list this year is to find out if the APE x86_64 hacks are replicable for the ARM64 architecture.
The closest thing to a scientific theory behind what APE is would be what the information security community calls a "polyglot". Researching that is another great way to learn more similarly inspired tricks.
> Is the same polyglot EXE possible also on 32-bit x86? If so, I find it even weirder this have not been done long ago, considering the strange hacks people have pulled over the years.
It's actually even easier to do for i386 than it is for x86_64. The blog post above explains why that's the case, due to the syscall magic numbers being more similar. Also I'm equally astonished no one did this before I came along. I think part of why that's the case, is that I couldn't just write APE. Doing this project meant that I had to implement a C library from scratch too, which is a years long coding marathon.
I haven't played around with it, but I remember being in awe of its ambition.
I haven't been following cosmopolitan, nor blink closely, but I just looked up cosmopolitan and realized you are the author of both.
Just want to say amazing work! Hope to get a chance to try out blink soon.
Me and the other user of Mips on OpenBSD are both glad you do!
(seriously though, thanks for doing all this. I like your philosophy compared to what the world ended up with as the dominant paradigm)
Still, Blink is a VM in the same sense as the JVM, and it does JIT compilation (or it can interpret program ASM) just as much as that. As far as I understand from the git page, it is using x86_64 assembly as the "bytecode" though, so the JIT step may be quite trivial if running on the same arch and/or OS.
Old post:
This isn't compiling to native either, not ahead of time anyway. It is compiling C or C++ to WASM, and then running that in a browser. The browser will JIT compile the WASM, just like the JVM would.
The biggest difference is that everyone has a browser, while not everyone has a JVM pre-installed.
EDIT: to realize it
Ruby is more like Smalltalk.
I'm old enough to remember when Java applets were invented, grew up using Visualage Smalltalk on OS/2 at school, and am still bitter that nobody ever said: but this is Smalltalk, why don't we use Smalltalk then? :)
Visual Age Smalltalk had a role similar to .NET on the OS/2 ecosystem, SOM (OS/2 version of COM) supported Smalltalk, implementation inheritance and meta-classes, so yeah it didn't help to go full on Java.
Also another Visual Age thing, Visual Age for C++ v4 also had a Smalltalk like experience for C++, unfortunely it was too demanding in resources.
There are other issues with Smalltalk that we know now that we didn't then. Such as broad and deep class hierarchies are hard to use. Smalltalk didn't enforce type-safety when I used it (i.e., you can have runtime faults because you can send any message to any class and if you didn't implement "does not understand", you won't know until exercising that branch).
AFAIR Java applets, and the JVM in general, were not better.
My experience with Smalltalk is from high school in the middle 90s, Java came out in 1996 and it was much slower than Smalltalk in my opinion.
Also JavaScript in the browser was basically a joke and a nightmare to write and debug.
Type safety is over-hyped IMO, JavaScript isn't type safe, look were it arrived.
Even C++ is partially type safe and Java type safety is unsound
I don’t know why it’s okay to steal product names like that.
... apart from that, it's a legit hard problem to name things. As in "One of the two recognized hardest problems in software engineering" (alongside cache management and off-by-one errors).