This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fork fails after nmap with hint address in an unmapped memory region

On Dec  9 23:40, Brian Inglis wrote:
> 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?

Long discussion on cygwin-developers way back when we developed the 64
bit version.  Basically:

* Leave lower 32 bit area of 44 bit address space free for Windows
* Leave upper 32 bit area of 44 bit address space free for Windows

The rest just came about:

  0x1:00000000 - 0x1:80000000	Stacks
  0x1:80000000 - 0x2:00000000	Cygwin DLL plus helper space
  0x2:00000000 - 0x4:00000000	Rebased DLLs
  0x4:00000000 - 0x6:00000000	Non-rebased DLLs
  0x6:00000000			Start address heap
0x700:00000000			Start address of mmap top down allocations

So heap and mmap are growing from different directions.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]