X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 348D53858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1674187037; bh=vEY19kBwAUtIni+/Tp+9ABSgZcaTiRpIqa6rrP8NeTg=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=JpnOkktk4+Ef187OwV1aVh+nJamvrt5C5Xrku3/65dRIH/sufx8hxsewMWp6bxtIx pG1fb+m4cDQ08C5j48K7nkVmOO8GsD7pfgrMouD4ek9905EVxDp+tFJXZHfFhoHlv0 m3bwr+QjYE505moEM7ReNeoMx8W3OfCxVHOCoNcY= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E877C3858CDA DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com 30K3uWW8008928 X-Nifty-SrcIP: [220.150.135.41] Date: Fri, 20 Jan 2023 12:56:33 +0900 To: cygwin AT cygwin DOT com Subject: Error: child_copy: cygheap read copy failed. Message-Id: <20230120125633.05136d9ae091b097fc9f9cf5@nifty.ne.jp> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Takashi Yano via Cygwin Reply-To: Takashi Yano Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" Hi Corinna, I am now working on porting ffmpeg for cygwin, and noticed that the following error sometimes happens. $ while true; do ffplay 2>&1 |grep cygheap; done 0 [main] ffplay (10172) child_copy: cygheap read copy failed, 0x0..0x800028FB8, done 0, windows pid 10172, Win32 error 299 0 [main] ffplay (13052) child_copy: cygheap read copy failed, 0x0..0x800028FB8, done 0, windows pid 13052, Win32 error 299 0 [main] ffplay (9092) child_copy: cygheap read copy failed, 0x0..0x800028FB8, done 0, windows pid 9092, Win32 error 299 0 [main] ffplay (8988) child_copy: cygheap read copy failed, 0x0..0x800028FB8, done 0, windows pid 8988, Win32 error 299 0 [main] ffplay (11800) child_copy: cygheap read copy failed, 0x0..0x800028FB8, done 0, windows pid 11800, Win32 error 299 0 [main] ffplay (6088) child_copy: cygheap read copy failed, 0x0..0x800028FB8, done 0, windows pid 6088, Win32 error 299 This seems to happen after the commit: commit 2f9b8ff00cce0d0ceeb1091b6b9aecae914ddb89 Author: Corinna Vinschen Date: Wed Oct 26 21:16:35 2022 +0200 Cygwin: decouple cygheap from Cygwin DLL One reason that ASLR is tricky is the fact that the cygheap is placed at the end of the DLL and especially that it's expected to be growable. To support ASLR, this construct must go. Define dedicated cygheap memory region and reserve entire region. Commit 3 Megs, as was the default size of the cygheap before. Fix linker script accordingly, drop a now useless version check in get_cygwin_startup_info(). I looked into this problem a bit and found that VirtualAlloc() for MEM_RESERVE of cygheap area in cygheap_fixup_in_child() failed with ERROR_INVALID_ADDRESS. It seems that the address range is already occupied for some reason. I also noticed that the following patch seems to resolve the issue. diff --git a/winsup/cygwin/local_includes/memory_layout.h b/winsup/cygwin/local_includes/memory_layout.h index a3a0cae70..67164cfaf 100644 --- a/winsup/cygwin/local_includes/memory_layout.h +++ b/winsup/cygwin/local_includes/memory_layout.h @@ -44,15 +44,15 @@ details. */ /* That's where the cygheap is located. CYGHEAP_STORAGE_INITIAL defines the end of the initially committed heap area. */ -#define CYGHEAP_STORAGE_LOW 0x800000000UL -#define CYGHEAP_STORAGE_INITIAL 0x800300000UL -#define CYGHEAP_STORAGE_HIGH 0xa00000000UL +#define CYGHEAP_STORAGE_LOW 0x70000000000UL +#define CYGHEAP_STORAGE_INITIAL 0x70000300000UL +#define CYGHEAP_STORAGE_HIGH 0x70200000000UL /* This is where the user heap starts. There's no defined end address. The user heap pontentially grows into the mmap arena. However, the user heap grows upwards and the mmap arena grows downwards, so there's not much chance to meet unluckily. */ -#define USERHEAP_START 0xa00000000UL +#define USERHEAP_START 0x00800000000UL /* The memory region used for memory maps. Mmaps grow downwards. Set the lowest address to leave ~32 Gigs for heap. Could you please have a look? -- Takashi Yano -- 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