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:references:from:to:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=dZmX4wqfOKtZn7AM 8nfZhB9l+m1cCGHU5WXfHWNJlg+wkA54P2NcbmgtDyUJQ+kV6eSjURdznKI1aViV xXeNAI+LyZB2Pd6YxJ8H0FgzM7Bpg6wM9meaSeTu+yFljg9Z8LCJ41kdbLsquod3 MW5EAhKo8HpvgRA7C2/9/OWD5kM= 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:references:from:to:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=aoD7oOn1XGnbKAZgVsXzYv 8SMXc=; b=h8wKhmgzoS4lurdHw60zgQtTuxialVOQU3S3sR0Ycl2BFATqbwwpuO mr9BImVEwe87AqCEzT5Ax0uU/dmQBw5wW1RREKZ+FVnAiMa83myNiXnwqN8sJ2nX cD6v/UBHSUAVBq2WEYwf8j4VysPlY/Qtk/shbb7SFL7sxwLKwql8I= 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: =?ISO-8859-1?Q?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=calgary, Calgary, =e9crit, St=e9phane?= X-HELO: smtp-out-so.shaw.ca X-Authority-Analysis: v=2.2 cv=JuuBlIwC c=1 sm=1 tr=0 a=MVEHjbUiAHxQW0jfcDq5EA==:117 a=MVEHjbUiAHxQW0jfcDq5EA==:17 a=N659UExz7-8A:10 a=w_pzkKWiAAAA:8 a=YFKJWNbBhkHZyMvudpYA:9 a=bXJW_VwjpXIzlcxt:21 a=HzxXBR4LEY_o3STC:21 a=pILNOxqGKmIA:10 a=-Vpxz2_-K9QA:10 a=sRI3_1zDfAgwuvI8zelB:22 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 References: <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 To: cygwin AT cygwin DOT com Message-ID: <715b8bf4-ab6e-3c37-9ad2-f7c6bc3119d1@SystematicSw.ab.ca> Date: Sat, 9 Dec 2017 23:40:51 -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: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfOCcNOMctXSkpKiiCuxAAVELTt6SDoH7Mgk1on240l3zHbAWkj8kbYFkjnUzKUYIgIkNPzs65MIZFPEJ+ikTNcZtyUAJ0enh5BZfvTpjlhMlwS/kf2mg hEFEIkeTQcoKO3wSPMh62932+tqU5WVJbCusodG4JlXChqIN8w/g240EanEpY8EQl3B8UoIVWFItmg== X-IsSubscribed: yes Note-from-DJ: This may be spam On 2017-12-09 15:51, Jon Turney wrote: > 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. > > If you're going to use addr2line to interpret a .stackdump file, I'm afraid > you're just supposed to know that the cygwin1.dll has an ImageBase of > 0x0000000180040000 on x86_64 Who came up with that magic number 6G256K and why - would a round 7/8G not do? >> $ more mmap_fork_stc.exe.stackdump >> Stack trace: >> Frame        Function    Args >> 000005FF3A0  0018005CD8E (0018021AE80, 0018021AC46, 00000008000, 000005FB010) >> 000005FF3A0  001800465F9 (000005FDDE0, 000005FF3A0, 001800B2D10, 00000000000) >> 000005FF3A0  00180046632 (00000000000, 000005FBE28, 00000008000, 00100402068) >> 000005FF3A0  00180046B84 (0007FFE0385, 000005FDDE0, 001800B2D10, 00000000000) >> 000005FF3A0  00180048040 (00000000000, 00000000000, 00000000000, 00000000000) >> 000005FF3A0  001800B2EDB (00000000000, 00000000000, 00000000000, 00000000000) >> 000005FF620  7FFF7777485F (00180040000, 00000000001, 00000240022, 000006D20C8) >> 000005FF620  7FFF7779D762 (7FFF77797900, 000006D2701, 7FFF774A27BA, 000006D2F10) >> 000005FF620  7FFF7779D5AB (000006D2720, 000005FF5D0, 00000000003, 0000032E000) >> 000005FF620  7FFF7779D5D1 (00000000003, 000005FF629, 00000000003, 00000000000) >> 00000000000  7FFF777E1D31 (00000000000, 00000000000, 00000000001, 00000000000) >> 00000000000  7FFF7781A1FC (00000000000, 00000000000, 0000032E000, 00000000000) >> 00000000000  7FFF777C9B1B (00000000000, 00000000000, 00000000000, 00000000000) >> 00000000000  7FFF777C9ACE (00000000000, 00000000000, 00000000000, 00000000000) >> End of stack trace > > Sator Arepo Tenet Opera Rotas! [1] > > 0x000000018005cd8e    cygwin_stackdump                 exceptions.cc:456 > 0x00000001800465f9    vapi_fatal                        dcrt0.cc:1296 > 0x0000000180046632    api_fatal                         dcrt0.cc:1305 > 0x0000000180046b84    child_info_fork::handle_fork()    dcrt0.cc:634 > 0x0000000180048040    dll_crt0_0()                      dcrt0.cc:777 > 0x00000001800b2edb    dll_entry                         init.cc:102 > > [1] https://cygwin.com/ml/cygwin/2015-08/msg00311.html Happen to have an old stackdump script around from 2013 without that magic. Neither helps more than the original error message, which tells us that there is a fork problem with the mmaps: either the mmap allocator is saving the wrong address, as it appears on a segment boundary, or something else in that structure is not being saved correctly for anonymous private mmap fixup, as changing the hinted address to a segment boundary keeps the magic smoke in. -- 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