cygwin + binutils 2.36 + ASLR/dynamicbase defaults

Christoph Reiter reiter.christoph@gmail.com
Sun Feb 28 12:28:08 GMT 2021


On Sun, Feb 28, 2021 at 1:16 PM ASSI <Stromeko@nexgo.de> wrote:
>
> Christoph Reiter via Cygwin writes:
> > binutils 2.36 now defaults to ASLR etc on Windows, so a cygwin compiled linker
> > will give you:
> >
> >> peflags -v mydll.dll
> > mydll.dll: coff(0x2026[+executable_image,+line_nums_stripped,+bigaddr,+dll])
> > pe(0x0160[+high-entropy-va,+dynamicbase,+nxcompat])
> >
> > Is this still problematic for cygwin?
>
> Yes it is and I'm currently figuring out how to best get rid of it in
> order to be able to update binutils (why this was ever allowed in
> without an accompanying configure option is a mystery to me).

OK, thanks (nxcompat as well btw?). I've reverted these changes in MSYS2 now:
https://github.com/msys2/MSYS2-packages/commit/c5757a43b42fb20730792469facf9a65571a2e81

> I've
> already nixed it for Cygwin, but I'm not yet sure what to do for the
> cross compilation toolchain.  While it should in principle work there,
> I'm pretty sure that there will be problems when it comes to the nitty
> gritty details.  It's already transpired that some of the linker scripts
> can't deal with the larger base addresses this change does generate
> eventually.

MSYS2 builds all packages with ASLR since 6 months, so things look good.
We've added a patch that allows reverting the base address if needed:
https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-binutils/2001-ld-option-to-move-default-bases-under-4GB.patch

> > The reason I'm asking is because we updated to 2.36 in MSYS2 and are
> > wondering if we need to patch this out (or change the defaults) It
> > seems to work as is right now, but maybe we are just lucky(?).
>
> You are just lucky and need to test more. :-)
>
> Note that the change does not only affect DLL as the commit message
> would want you to believe and you will eventually end up with a
> situation where ASLR tries moves the stack of an executable, at which
> point you can no longer fork.

OK, thanks.


More information about the Cygwin mailing list