mmap failure [was: cygrunsrv + sshd + rsync = 20 times too slow -- throttled?]

Ken Brown kbrown@cornell.edu
Sun Sep 5 00:04:30 GMT 2021


On 9/4/2021 6:58 PM, Ken Brown via Cygwin wrote:
> On 9/4/2021 6:54 PM, Ken Brown via Cygwin wrote:
>> On 9/4/2021 6:37 PM, Ken Brown via Cygwin wrote:
>>> I've reduced the procps failure to the following test case:
>>>
>>> $ cat mmap_test.c
>>> #include <unistd.h>
>>> #include <stdio.h>
>>> #include <sys/mman.h>
>>>
>>> int
>>> main ()
>>> {
>>>    void *addr;
>>>    int page_size = getpagesize ();
>>>
>>>    addr = mmap (0, page_size, PROT_READ | PROT_WRITE,
>>>                 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
>>>    if (addr == MAP_FAILED)
>>>      perror ("mmap");
>>> }
>>>
>>> $ gcc mmap_test.c
>>>
>>> $ ./a
>>> mmap: Invalid argument
>>>
>>> This happens if I use cygwin1.dll built from the current git master.  But it 
>>> also happens if I build from cygwin-3_2_0-release with the recent patches 
>>> applied that make Cygwin build without error:
>>>
>>> 0e12b4939 Cygwin: C++17: register keyword is deprecated
>>> a7340e0c0 Cygwin: dumper: fix up GCC pragma for g++ 11.2
>>> 2a212c086 Cygwin: workaround a g++ 11.2 initialization bug
>>> 9e3f1737e Cygwin: loader script: add DWARF 5 sections
>>> bdfd2b004 Cygwin: testsuite: avoid "conflicting types" gcc warning
>>> 6fc498e2e strstr: avoid warnings
>>> 26da270b2 ldexp/ldexpf: avoid assembler warning
>>> edce2a557 Cygwin: fix declaration of RtlInitEmptyUnicodeString
>>
>> Sorry, those commit ids are wrong.  They're what I got after rebasing the 
>> master branch so that those commits come first.
> 
> [Pressed Send too soon.]
> 
> Here are the correct commits:
> 
> 8169e39ab Cygwin: C++17: register keyword is deprecated
> 3ca80b360 Cygwin: dumper: fix up GCC pragma for g++ 11.2
> bdb7991db Cygwin: workaround a g++ 11.2 initialization bug
> 801120c1f Cygwin: loader script: add DWARF 5 sections
> d5cc66426 Cygwin: testsuite: avoid "conflicting types" gcc warning
> c2fe205b5 strstr: avoid warnings
> 76c2c7a89 ldexp/ldexpf: avoid assembler warning
> eeeb5650c Cygwin: fix declaration of RtlInitEmptyUnicodeString
> 
>>
>>> So there appears to be something wrong with cygwin1.dll built with the 
>>> current build tools (gcc 11.2.0, binutils 2.37, not sure what else is relevant).

Wait a minute...I'll bet this is related to the MEM_EXTENDED_PARAMETER 
initialization problem that was dealt with in commit bdb7991db.

Ken


More information about the Cygwin mailing list