X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:reply-to:message-id :date:mime-version:in-reply-to:content-type; q=dns; s=default; b= NWVxmD/jMYo7BwWK2NrG+B+FcTct7t+rlWPCLClROBdDbjUHvC5bKeC/Vi+F4a3P tr1xWdkMw5BACAXBj84H/+nU4QalKQH10Ka0bxNfBUclUMXYmAGYEOGpkb5o13Il vVVBWLCObU/Tk7cfYTtO9YJ5nXfpJEKYGhHaIKlzZpU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:reply-to:message-id :date:mime-version:in-reply-to:content-type; s=default; bh=9IUKm rpjhJRS3KWlrwqNbhInOH0=; b=XZRyEZ7mHSFmw9LRYbMj5oH1uqsrxS4/Qhm6R HEMnExB7kv6rjELik3zOOdFOsKUhkaR+jYnCIJkPJVDjnGs3gqzw53Qo1OtDSMQK zI1ZNb17LPqHgBo/Ay2FWMi2pjrprUs17kXszM8tVLIVtklL+4stpFlPbKtDEZTB T1UED8= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HX-HELO:sk:sonic31, Hx-languages-length:2316, H*M:yahoo, Hx-spam-relays-external:ESMTPA X-HELO: sonic310-14.consmr.mail.ir2.yahoo.com Subject: Re: fork fails after nmap with hint address in an unmapped memory region To: cygwin AT cygwin DOT com References: <15510444518 DOT 20171209184819 AT yandex DOT ru> From: "Stéphane Mbape via cygwin" Reply-To: =?UTF-8?Q?St=c3=a9phane_Mbape?= Message-ID: Date: Sun, 10 Dec 2017 02:23:45 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <15510444518.20171209184819@yandex.ru> Content-Type: multipart/mixed; boundary="------------22148750650060F52002C78A" --------------22148750650060F52002C78A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit I used a temporary fix that may give you a hint. hint_addr = hint_addr - hint_addr % getpagesize(); // temporary fix I also used it in luajit, which uses a random hint_addr, and everything is fine. On 09/12/2017 18:29, Brian Inglis wrote: On 2017-12-09 08:53, Stéphane Mbape via cygwin wrote: Le 09/12/2017 à 16:48, Andrey Repin a écrit : While embeding luajit in a c program, I found myself unable to fork processes. Investigations prove that it was related to nmap. To be accurate, calling nmap with hint address in a unmapped memory region will cause all forks to fail with "fixup_mmaps_after_fork: ReadProcessMemory failed for MAP_PRIVATE address 0x6FFFFFE0000, Win32 error 299" There is a sample code below. You forgot to mention Cygwin version you're using, and please provide the sample as an attach to save people the copy-pasting issues. Cygwin version: 2.9.0 OS: Windows 10 Arch: 64bit The sample was also attached. Confirmed reproducible; addr2line does not give anything useful from the stackdump, but included raw stackdump below, in case it gives hints. --------------22148750650060F52002C78A Content-Type: text/plain; charset=UTF-8; name="doscript.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="doscript.c" I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1 ZGUgPHN5cy9tbWFuLmg+CiNpbmNsdWRlIDxzeXMvd2FpdC5oPgojaW5jbHVk ZSA8dW5pc3RkLmg+CiNpbmNsdWRlIDxzdGRpbnQuaD4KI2luY2x1ZGUgPHdp bmRvd3MuaD4KCiNkZWZpbmUgTU1BUF9QUk9UICAgICAgICAgICAoUFJPVF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ICBpZiAoY2hpbGRfcGlkIDwgMCkgewogICAgICAgIHBlcnJvcigiZm9y ayBmYWlsZWQiKTsKICAgIH0gZWxzZSBpZiAoY2hpbGRfcGlkID09IDApIHsK ICAgICAgICBwcmludGYoIkkgYW0gd29ya2VyICVkXG4iLCAoaW50KSBnZXRw aWQoKSk7CiAgICAgICAgc2xlZXAoMik7CiAgICAgICAgcHJpbnRmKCJ3b3Jr ZXIgZXhpdGluZ1xuIik7CiAgICAgICAgZXhpdCgwKTsKICAgIH0KCiAgICB3 YWl0KE5VTEwpOwoKICAgIHByaW50ZigibWFzdGVyIGV4aXRpbmdcbiIpOwog ICAgcmV0dXJuIDA7Cn0K --------------22148750650060F52002C78A Content-Type: text/plain; charset=us-ascii -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple --------------22148750650060F52002C78A--