Re:Linux as co-operative Windows process
by p_ing on Sunday February 09, 2025 @11:39AM
(#42991707)
You're not going to take over NT's control of the MMU et. al. without elevated privileges. To run as a non-admin, you either need a VM that leverages NT's built-in virtualization capabilities (requires admin to enable), a separate personality (requires admin to install), or a Win32 application a la cygwin, which isn't very good.
[ Parent
| on HN ]
Re:Linux as co-operative Windows process
by anybody8824 on Sunday February 09, 2025 @12:15PM
(#42991950)
You could try to use the Win32 debug API in the same way like Linux UML by using ptrace. But it would probably still be much slower because of missing things like PTRACE_SYSCALL.
More performant would be a noMMU variant of UML for Windows, supporting only PIE executables, similar to nabla-linux [1]. This is also quite similar to how mssql for Linux works NT kernel+Win32 in a single usermode process (single address space) [2]. Interestingly, mssql also uses memory protection keys to recover a bit of fault tolerance but last time I checked Win32 does not have an API for MPKs.
SeDebugPrivilege requires local admin, which would be required to debug a process the user doesn't own. This privilege level is just about the highest one you can obtain in NT.
You could do a very slow x86 interpreter.
Re:Linux as co-operative Windows process
by password4321 on Sunday February 09, 2025 @12:40PM
(#42992101)
Re:Linux as co-operative Windows process
by quotemstr on Sunday February 09, 2025 @11:59AM
(#42991846)
The site is down, so I can't see what they're doing with the MMU: that said, most virtual memory management works just fine from normal boring userspace. If wine can do it for running win32 on Linux, this thing can do it for running Linux stuff on win32, which isn't less powerful when it comes to virtual memory management.
Re:Linux as co-operative Windows process
by badc0ffee on Sunday February 09, 2025 @12:09PM
(#42991905)
It's been years since I used Wine, but I think it just runs each Windows process in its own Linux process. There's no Wine "kernel" that needs to manage virtual memory or isolate multiple processes.
Re:Linux as co-operative Windows process
by lproven on Monday February 10, 2025 @01:39PM
(#43003575)
AIUI this is correct, yes.
Re:Linux as co-operative Windows process
by quotemstr on Monday February 10, 2025 @08:24PM
(#43007809)
Sort of. Wine still has a privileged (w.r.t. other wine processes) manager process that handles coordination between other wine processes. Whether that's a "kernel" is a matter of opinion.
The VMM is part of the kernel (or executive), not userspace. App requests memory, VMM assigns pages from RAM, page file, or backing store.
If you wanted to segment yourself and take over anything 'below' the kernel like the MMU, you'd need elevated rights. But that'd be some interesting programming.
https://en.wikipedia.org/wiki/Architecture_of_Windows_NT#/me...
Re:Linux as co-operative Windows process
by quotemstr on Sunday February 09, 2025 @04:31PM
(#42994225)
Huh? What are you talking about? I can manipulate page tables just fine from userspace through the magic of MapViewOfFile.
Re:Linux as co-operative Windows process
by lelandbatey on Sunday February 09, 2025 @09:39PM
(#42996364)
Don't besmirch the good name of Cygwin, I daily drove that for Python development for 2 years and it worked shockingly well. In retrospect I think I liked Cygwin more than I liked WSL because I really could interoperate my Linux/Windows together nearly seamlessly. But I think that was because I was operating and using tools right in the sweet spot of the Cygwin abstraction; e.g. no GUI programs, sockets/file work only.
Agreed. For a long time, Cygwin was the best Unix userland. It also fit conveniently into a single folder, allowing multiple portable environments on the same machine. Mingw was pretty nice too.