| delorie.com/archives/browse.cgi | search |
| 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:reply-to:subject:to:references:from:message-id | |
| :date:mime-version:in-reply-to:content-type | |
| :content-transfer-encoding; q=dns; s=default; b=gf8t/vV7QR1URlq7 | |
| tP/Vd4oxfHEws6QRAbgjWVxiWo3fqPQ1zuzfXiWRkCskSqZkl0HtbX1NW0B799x2 | |
| ds3Gz+iTiLqMw+hkLB+7f4C3nC0n2pCCkRSsB+zvVFzCMAwGZmp9I3aEyzgE9Oob | |
| y93ipfTi+A8oq7vi+YICBf9Qf7Y= | |
| 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:reply-to:subject:to:references:from:message-id | |
| :date:mime-version:in-reply-to:content-type | |
| :content-transfer-encoding; s=default; bh=Keaum0iS4jVzSyJz0aD5SC | |
| RgTNA=; b=oVx9yEsc7FzZcd1lIQgrJBGly0FUGn73PHuu6bMFSohPV2zuUb68KG | |
| 84Nkdm5u0Mnh9ZXvPomiUc49pLCcMO02R5N5bLll3LHejfqfjlGT1F7TeycFVrz3 | |
| SQ75a7395RMtf2Rlm0Q6MXwy3k1f1Ovi7ETOLoZi/mnsTUOhgDxS0= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| 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=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=Resource, calgary, H*Ad:D*ca, 5168 |
| X-HELO: | smtp-out-no.shaw.ca |
| X-Authority-Analysis: | v=2.2 cv=b+PC2pOx c=1 sm=1 tr=0 a=MVEHjbUiAHxQW0jfcDq5EA==:117 a=MVEHjbUiAHxQW0jfcDq5EA==:17 a=N659UExz7-8A:10 a=tUIJT-X9uJ4hWQWMBxoA:9 a=wUnfT_OwsfjsOKp6:21 a=eTqw0FranJThBJWm:21 a=pILNOxqGKmIA:10 |
| Reply-To: | Brian DOT Inglis AT SystematicSw DOT ab DOT ca |
| Subject: | Re: fork fails after nmap with hint address in an unmapped memory region |
| To: | cygwin AT cygwin DOT com |
| References: | <b431898c-30f5-2847-c922-0f25a525ef76 AT yahoo DOT fr> <15510444518 DOT 20171209184819 AT yandex DOT ru> <42c71a45-e61b-6917-b634-e912fb51d2d5 AT yahoo DOT fr> <56047a39-4e1e-fa50-0e8b-c123c5b5ed3c AT SystematicSw DOT ab DOT ca> |
| From: | Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca> |
| Message-ID: | <da3c44fe-42be-739e-78f2-6d0cedd88e9e@SystematicSw.ab.ca> |
| Date: | Sat, 9 Dec 2017 14:57:10 -0700 |
| 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: | <56047a39-4e1e-fa50-0e8b-c123c5b5ed3c@SystematicSw.ab.ca> |
| X-CMAE-Envelope: | MS4wfHfiFo8TGNuNZzFt8YysYwYCRiYjNR7NNOuSVTHcPMoid+Mwdqdq/Cbu85Iab/BJHH1UYpf2C5sJWdCie2I0Hu5dGAmdIs9Sxf0XKEJf7Qn0H4HmbeH9 WGEVVavZ1YyE/kOts/jB4a2fmtIE9CE1pEowDsVi33ft+itQV/vAZ9NeqqDpwh2orFHEnQ9wZ5BjUA== |
| X-IsSubscribed: | yes |
On 2017-12-09 11: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.
> Complete output after renaming doscript.c to mmap_fork_stc.c, also with addr +
> 4096 as well as addr + 1:
>
> $ gcc -g -O0 -o mmap_fork_stc{,.c}
> $ ./mmap_fork_stc
> I am master 5464
> nmap() = 0x6fffffe0000, hint_addr = 0x0
> nmap() = 0x6fffffe0000, hint_addr = 0x6fffffe1000
> 1 [main] mmap_fork_stc 11408 fixup_mmaps_after_fork: ReadProcessMemory
> failed for MAP_PRIVATE address 0x6FFFFFE0000, Win32 error 299
> 286 [main] mmap_fork_stc 11408 ...\mmap_fork_stc.exe: *** fatal error in
> forked process - recreate_mmaps_after_fork_failed
> 1298 [main] mmap_fork_stc 11408 cygwin_exception::open_stackdumpfile: Dumping
> stack trace to mmap_fork_stc.exe.stackdump
> 0 [main] mmap_fork_stc 5464 fork: child -1 - forked process 11408 died
> unexpectedly, retry 0, exit code 0x100, errno 11
> fork failed: Resource temporarily unavailable
> master exiting
Test works if you use addr + 65536 or addr + sysconf(_SC_PAGE_SIZE), as another
thread reminded me about mmap region alignment to 64KB boundaries.
$ ./mmap_fork_stc
I am master 1888
nmap() = 0x6fffffe0000, hint_addr = 0x0
nmap() = 0x6ffffff0000, hint_addr = 0x6ffffff0000
I am worker 5168
worker exiting
master exiting
Perhaps mmap() should round up/down address arguments to this alignment when
they should be treated as hints.
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
--
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |