public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eliot Moss <moss@cs.umass.edu>
To: Jason Pyeron <jpyeron@pdinc.us>, cygwin@cygwin.com
Subject: Re: [cygwin] Re: Mandatory ASLR breaks Cygwin - Windows 10
Date: Tue, 25 Aug 2020 11:56:41 -0400	[thread overview]
Message-ID: <bd42ad69-6955-801c-5708-8847abcef71a@cs.umass.edu> (raw)
In-Reply-To: <1b2501d67af3$efcd9e80$cf68db80$@pdinc.us>

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

  reply	other threads:[~2020-08-25 15:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25 14:16 Alexandria Cortez
2020-08-25 14:34 ` Eliot Moss
2020-08-25 14:36   ` Alexandria Cortez
2020-08-25 15:13     ` Brian Inglis
2020-08-25 15:25       ` [cygwin] " Jason Pyeron
2020-08-25 15:56         ` Eliot Moss [this message]
2020-08-25 21:49           ` Brian Inglis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd42ad69-6955-801c-5708-8847abcef71a@cs.umass.edu \
    --to=moss@cs.umass.edu \
    --cc=cygwin@cygwin.com \
    --cc=jpyeron@pdinc.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).