X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6B4E3857733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1686745244;
	bh=2ILWbObLxmQBezOy1ZNVJErD6UsY1RVx1XSf9qPzXec=;
	h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:
	 List-Help:List-Subscribe:From:Reply-To:From;
	b=YK4H2dB2F4PgsTj3ggQNr1B4X5USRPAUrqu/U6WhvnBnijyRXR5ElQ4pCMWwk3bh9
	 xThmdmd9gjGZPMJnNp5+3jPt2Zry9eB2nMa4Ox2A0M+HZURGNWXR10BBSsTSbYTLgw
	 7EjL83kUDjItwTmQU0z5TQpO9gdjyev1vLLmSydc=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 297F63858281
MIME-Version: 1.0
Date: Wed, 14 Jun 2023 14:20:02 +0200
To: <cygwin@cygwin.com>
Subject: fork bug in cygheap
Message-ID: <b7a37aeabe4ce0df6b33f55088a28150@tiscali.it>
X-Sender: paolo.zambotti@tiscali.it
X-Originating-IP: 165.225.202.80
X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_50, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE,
 RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP,
 T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
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: Paolo via Cygwin <cygwin@cygwin.com>
Reply-To: paolo.zambotti@tiscali.it
Content-Type: text/plain; charset="utf-8"
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 35ECL8kD006062

  Hi all,

I just found a bug (I think) in cygheap_fixup_in_child
function (cygheap.cc).
the effect is that, sometimes a command from a
script ends with the following error message

0 [main] openssl (17784)
child_copy: cygheap read copy failed, 0x0..0x8003D8538, done 0, windows
pid 17784, Win32 error 299

Digging a little bit in the code I found
that commit_size in cygheap_fixup_in_child is wrongly calculated if the
condition (child_proc_info->cygheap_max > (void *)
CYGHEAP_STORAGE_INITIAL) is met.

Currently, in that case, its value is
evaluated as

commit_size = allocsize
(child_proc_info->cygheap_max);

but I think this is wrong and it should
be

commit_size = allocsize (child_proc_info->cygheap_max) -
CYGHEAP_STORAGE_LOW;

The wrong value avoids the successful execution of
the following second VirtualAlloc and the the error in child_copy
function.

I tried to recompile the cygwin dll with the above change and
indeed the error disappears.

I'm I correct?
Paolo. 



VOUCHER CONNETTIVITÀ per P.IVA e PMI: internet a canone 0 per 48 mesi. ATTIVA ORA
 https://casa.tiscali.it/promo/?u=https://promozioni.tiscali.it/voucher_business/?r=TS00000A00025&dm=link&p=tiscali&utm_source=tiscali&utm_medium=link&utm_campaign=voucherbusiness&wt_np=tiscali.link.footermail.voucherbusiness.btb..


-- 
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

