From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailsrv.cs.umass.edu (mailsrv.cs.umass.edu [128.119.240.136]) by sourceware.org (Postfix) with ESMTPS id 2761D3857807 for ; Tue, 25 Aug 2020 15:56:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2761D3857807 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cs.umass.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=moss@cs.umass.edu Received: from [192.168.0.16] (c-24-62-203-86.hsd1.ma.comcast.net [24.62.203.86]) by mailsrv.cs.umass.edu (Postfix) with ESMTPSA id CC33F401F19D; Tue, 25 Aug 2020 11:56:41 -0400 (EDT) Reply-To: moss@cs.umass.edu Subject: Re: [cygwin] Re: Mandatory ASLR breaks Cygwin - Windows 10 To: Jason Pyeron , cygwin@cygwin.com References: <4AA035EB-1325-4C1B-B399-28FC9176F203@roc.cs.umass.edu> <006c01d67aed$2f7f0660$8e7d1320$@linuxandria.com> <1b2501d67af3$efcd9e80$cf68db80$@pdinc.us> From: Eliot Moss Message-ID: Date: Tue, 25 Aug 2020 11:56:41 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <1b2501d67af3$efcd9e80$cf68db80$@pdinc.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_NUMSUBJECT, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2020 15:56:43 -0000 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