DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 44S2GZEw1014738
Authentication-Results: delorie.com;
	dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=oeJGwsYF
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E7103884524
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1716862593;
	bh=Ct9/MD3yon/RVuTFl6tV4VP1AI0k8cdkP760yuP1tKE=;
	h=Date:To:Cc:Subject:In-Reply-To:References:List-Id:
	 List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
	 From:Reply-To:From;
	b=oeJGwsYFmAMLtpPTCXvUNm24pvyHugQoJ6ABWJcdSTqC5wMTCj/OXIzQsYLYJwlSg
	 u86+eEBd1jfo7THNnLcl6WyH0956s2j6laMclNtXUzRSDhObBXtLuO6uCvY8RaSRHK
	 2EJqZ8TqEVk2sjacNYrrzX8O8LlRV7yzL7skBq8U=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 64C4F3846096
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 64C4F3846096
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716862572; cv=none;
 b=gHDnKX17S1ykIpytlZ1trxqCctumyzAlK4cfxmIdZs0UE5eAWj1gX/FdS12iyVK1tj9We5Gw56V1p4fDS9HE5RGbwnXQBqrglaIoU6jZ2x6AuTc9dgP1rVsQHYxkd0bAOxo6BZY1uI7IIXGytr/k1m1DgTO/yvwnwP0ahba4P8c=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1716862572; c=relaxed/simple;
 bh=+c9Qz6faoDda05ZtgBd93hOmvxVNYd8whpwxltgmO6E=;
 h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature;
 b=sX1j4ZXP+nuwD93IjUbsXpXgB2C7DK1ISBRLgR4cHoHUVitJ46XzGg9/6RDpydajCk9erVWTwqzHu4xCqfLML/zrK+FxZyLpBKxmuYj/Ck9Oaj9W0BgfGfy6pwPhjzkOZPq0AjdAauchAOD93ZQwOVwOHrlorEFDDUY+kv7aX8o=
ARC-Authentication-Results: i=1; server2.sourceware.org
Date: Tue, 28 May 2024 11:16:08 +0900
To: cygwin@cygwin.com
Cc: Jeremy Drake <cygwin@jdrake.com>
Subject: Re: frequent hangs running ldd
Message-Id: <20240528111608.7b44c054f4c71171db49d6cc@nifty.ne.jp>
In-Reply-To: <20240528105800.52e5e55e3d7576640d9150ef@nifty.ne.jp>
References: <fd3b2d14-0d16-9e66-f7ea-daadc0c5bfcc@jdrake.com>
 <20240525045424.ac58c0ff5e325706b2a5f014@nifty.ne.jp>
 <0bd2f49b-93f6-7db4-32b6-7f3021db211e@jdrake.com>
 <20240525071739.167d0f2b66b3dd8d2313be19@nifty.ne.jp>
 <199f58b5-be55-a490-b94c-8b1ec7ff10fe@jdrake.com>
 <74e13efb-885a-3a90-f530-a6aa14bc5953@jdrake.com>
 <1048b7a2-34fc-616e-1f9e-ce46dbc6d704@jdrake.com>
 <8292a53a-15f6-da7c-c1d8-201418d1c589@jdrake.com>
 <cebac6b9-51e9-63fa-9d67-ef4f913160ca@jdrake.com>
 <20240528105800.52e5e55e3d7576640d9150ef@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=-4.0 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE,
 SPF_HELO_PASS, 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-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
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: Takashi Yano via Cygwin <cygwin@cygwin.com>
Reply-To: Takashi Yano <takashi.yano@nifty.ne.jp>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

Hi Jeremy,

On Tue, 28 May 2024 10:58:00 +0900
Takashi Yano wrote:
> On Fri, 24 May 2024 19:29:43 -0700 (PDT)
> Jeremy Drake wrote:
> > On Fri, 24 May 2024, Jeremy Drake wrote:
> > 
> > > On Fri, 24 May 2024, Jeremy Drake wrote:
> > >
> > > > Looking at !address, it seems Windows put the PEB, TEBs, and stacks in the
> > > > area where the cygheap should be.  Way to go, ASLR :P
> > >
> > > I think the fix for this would be to add -Wl,--disable-high-entropy-va to
> > > ldh_LDFLAGS, as was done for strace and cygcheck at least.  I used peflags
> > > -d0 /usr/bin/ldh.exe and I'm not seeing a hang after that.
> > 
> > Sorry, that was peflags -e0 not -d0 (dynamicbase is still on):
> > $ peflags -v /usr/bin/ldh.exe
> > /usr/bin/ldh.exe:
> > coff(0x0226[+executable_image,+line_nums_stripped,+bigaddr,+sepdbg])
> > pe(0x0140[+dynamicbase,+nxcompat])
> 
> You are right!
> 
> It seems that VirtualAlloc() in cygheap_init() in mm/cygheap.cc
> fails when the address range which cygwin uses is occupied due to
> high-entropy-va in ldh.exe.
> 
> Thanks for the analysis.

Would you make a patch for that?

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

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