X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 60433385F02C
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1631089196;
	bh=ZM8Vn+4yF6DcZoAypTFtmbPvyRYbjsMdquto8rDqncs=;
	h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
	 From;
	b=X9Pqmuy4ezp5uDepNTjQDkTnIvTgModCy+msb3M2DVSLNwzFeKas7Sn267kFzxZ6/
	 JVRM66/J95qoa4/jn6Bicid6CgysDfRtUE+VKyKjnCl2JaAS2fKP9k8qygrDNQudBa
	 qb34zY/U+rOeuKIkQ10ECu/cfKlVIZo47YOsiaUQ=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DCD293858407
Date: Wed, 8 Sep 2021 10:18:40 +0200
To: cygwin@cygwin.com
Subject: Re: mmap failure [was: cygrunsrv + sshd + rsync = 20 times too slow
 -- throttled?]
Message-ID: <YThx4K4s55y6WzTv@calimero.vinschen.de>
Mail-Followup-To: cygwin@cygwin.com
References: <40275f71-7c10-55a9-e6c8-a948e32c37ac@cornell.edu>
 <YTY0oN9x7wNtJAKx@calimero.vinschen.de>
 <d3c9bb17-b859-e7b1-d7e6-c421d0f37836@cornell.edu>
 <33ae27cb-4e45-7484-40d1-6cbd88c958f1@cornell.edu>
 <YTZXGlvWWUk23bJI@calimero.vinschen.de>
 <YTZY/vytb7nagC6M@calimero.vinschen.de>
 <3a63eb8c-3e8e-cd2c-b9de-8c34fa041a75@cornell.edu>
 <5b705ae7c9747a9cc25d2610cc6748e92bbe1d70.camel@dontech.dk>
 <890dad21-dec5-cdd1-bf99-bdb45e759a71@cornell.edu>
 <742331ee-4d9f-e86f-9314-c85b5f0cbfa8@SystematicSw.ab.ca>
MIME-Version: 1.0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H70lD9xYDSzVayJyoiAKnH8H+mHlML1QFij/+Znbn176CQ
 ktOauli900m8YE/JMhQscXlkGiyyG2cJy7OJGpHrWEh8zbxNkbcG8IdA5nE=
X-Spam-Status: No, score=-98.5 required=5.0 tests=BAYES_00, BODY_8BITS,
 GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE,
 RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL,
 TXREP autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin@cygwin.com>
Reply-To: cygwin@cygwin.com
Cc: Corinna Vinschen <corinna-cygwin@cygwin.com>
Content-Type: text/plain; charset="utf-8"
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 1888JvhC001516

On Sep  6 21:34, Brian Inglis wrote:
> On 2021-09-06 15:24, Ken Brown via Cygwin wrote:
> > On 9/6/2021 4:54 PM, Peter Dons Tychsen wrote:
> > > Hi there,
> > > 
> > > On Mon, 2021-09-06 at 14:40 -0400, Ken Brown via Cygwin wrote:
> > > > > No, wait.  I get what you say.  The optimzation settings of the test
> > > > > case should have no influence on the code inside the DLL.  That
> > > > > doesn't
> > > > > make sense for sure.  However, I ran the testcase under GDB, I could
> > > > > reproduce the issue, and I could fix it by setting mmap_ext.Reserved
> > > > > = 0;
> > > > > Go figure!
> > > > 
> > > > I don't get it, but I can confirm that the problem is fixed.
> > > 
> > > That sounds a bit like a voodoo fix, that could quickly regress again.
> > > 
> > > Here is my 2 cents:
> > > 
> > > Currently the mmap_ext structure is setup like this:
> > > 
> > >   215       MEM_EXTENDED_PARAMETER mmap_ext = {
> > >   216         .Type = MemExtendedParameterAddressRequirements,
> > >   217         .Pointer = (PVOID) &mmap_req
> > >   218       };
> > > 
> > > This means that all other entries in the struct are zero at
> > > initialization as described here:
> > > https://en.cppreference.com/w/c/language/struct_initialization
> > > 
> > > So if you set "mmap_ext.Reserved = 0" again after that its a double
> > > failure.
> > 
> > You're looking at the wrong source code.  The bug didn't occur until the
> > code was changed to do the following:
> > 
> >        /* g++ 11.2 workaround: don't use initializer */
> >        MEM_EXTENDED_PARAMETER mmap_ext;
> >        mmap_ext.Type = MemExtendedParameterAddressRequirements;
> >        mmap_ext.Pointer = (PVOID) &mmap_req;
> > 
> > This left mmap_ext.Reserved uninitialized, which Corinna has now fixed.
> 
> With undocumented structure member initialization an issue, maybe better to
> future proof using e.g.
> 
> 	MEM_EXTENDED_PARAMETER mmap_ext = { 0 }; // or memset or bzero
> 	...

You're right.  The bits in Reserved are just that, reserved.  So MSFT
may decide to use some of the  bits for other purposes, should the need
arise.  I've fixed that in git master.


Thanks,
Corinna

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

