[cygwin] Re: Mandatory ASLR breaks Cygwin - Windows 10

Eliot Moss moss@cs.umass.edu
Tue Aug 25 15:56:41 GMT 2020


Following up ...

One possible practical direction than can ameliorate this in some cases, and more importantly, 
perhaps speed up creation of child processes, would be to support posix_spawn more directly under 
Cygwin.  Right now, it does fork and then adjusts things, incurring all the problems and overheads 
of fork.  The full generality of posix_spawn would be hard to do in a more direct (non-fork) manner. 
  It _may_ be possible to handle the simplest cases.

posix_spawn is. roughly, fork + exec, meaning the newly forked child is going to get replaced 
anyway.  However, a number of things can be adjusted in this procedure, described by additional 
arguments to posix_spawn.  It might be that the most common and straightforward cases could be done 
directly, split off from the current, general case.  However, the implementers suggest that even 
this would involve a lot of effort

People also ask: Can't we get the Windows team just to support fork?  The answer has been 
consistently "no".  WSL (Windows Subsystem for Linux) version 1 appears to implement fork similarly 
to Cygwin - in any case, it incurs similar overheads.  They are able to exploit some private 
interface, I believe, that avoids Cygwin's hassles with ASLR, but I don't really know.  Fork 
performance under WSL1 is comparable to fork's performance in Cygwin.

Meanwhile, WSL version 2 runs under a hypervisor and thus implements its own fork directly, giving 
speeds more like Linux (a _lot_ faster).  Hence it is clear that the Windows OS team do not intend 
to support fork - they'd just say "use a hypervisor".  And of course the way WSL 2 uses hypervisor 
technology is inside out to the way VirtualBox (etc.) virtualizes hardware, which means that 
VirtualBox essentially doesn't work (at least not reliably and with good performance) when Windows 
hardware virtualization is turned on.  (I went through a whole long deal to figure out how to 
really, really, turn it off so that I can run VirtualBox, which I need for other purposes.  And of 
course doing so defeats some of Microsoft's more recent OS additions to improve security.)

Hope some of these tidbits are helpful in understanding the situation - one of longstanding 
frustration to Cygwiners, but not the fault of our excellent volunteer support team!

Regards - Eliot Moss


More information about the Cygwin mailing list