On Thu, 10 Jul 2025, Radek Barton wrote:

> Hello.
>
> Does this disable ASLR completely, or `-Wl,--disable-dynamicbase` is
> needed as well? If it would just disable High-entropy VA but not ASLR,
> wouldn't it make the situation worse because there would be higher
> change for address space collision?

It just disables high-entropy VA.  This matches what other mingw utilities
that load cygwin1.dll do.  I believe that high-entropy VA allows the stack
(and apparently PEB and TEB) to be relocated in a way that could place it
in the way of some fixed-address Cygwin data structures.


>
> Radek
>
> ________________________________________
> From: Cygwin-patches 
> <cygwin-patches-bounces~radek.barton=microsoft....@cygwin.com> on behalf of 
> Jeremy Drake via Cygwin-patches <cygwin-patches@cygwin.com>
> Sent: Wednesday, July 9, 2025 8:47 PM
> To: cygwin-patches@cygwin.com <cygwin-patches@cygwin.com>
> Subject: [EXTERNAL] [PATCH] Cygwin: testsuite: link cygload with 
> --disable-high-entropy-va
>  
> This is a mingw program meant to demonstrate loading the Cygwin dll in a
> non-Cygwin process, but the Cygwin dll still initializes the cygheap on
> load in that case.  Without --disable-high-entropy-va, Windows may
> occasionally locate the PEB, TEB, and/or stacks in the address space
> that Cygwin tries to reserve for the cygheap, resulting in a failure.
>
> Fixes: 60675f1a7eb2 ("Cygwin: decouple shared mem regions from Cygwin DLL")
> Signed-off-by: Jeremy Drake <cyg...@jdrake.com>
> ---
>  winsup/testsuite/mingw/Makefile.am | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/winsup/testsuite/mingw/Makefile.am 
> b/winsup/testsuite/mingw/Makefile.am
> index 25300a15d9..775d617aef 100644
> --- a/winsup/testsuite/mingw/Makefile.am
> +++ b/winsup/testsuite/mingw/Makefile.am
> @@ -23,7 +23,7 @@ cygrun_SOURCES = \
>
>  cygload_SOURCES = \
>          ../winsup.api/cygload.cc
> -cygload_LDFLAGS=-static -Wl,-e,cygloadCRTStartup
> +cygload_LDFLAGS=-static -Wl,-e,cygloadCRTStartup 
> -Wl,--disable-high-entropy-va
>
>  winchild_SOURCES = \
>          ../winsup.api/posix_spawn/winchild.c
> --
> 2.50.1.windows.1
>

-- 
All true wisdom is found on T-shirts.

Reply via email to