X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7808B3874C07
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1614515303;
	bh=57J1WrpBa1z4XepKWw13ySbHeCMdIyb8sawvBWay0T8=;
	h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
	 From;
	b=yX+1LtgqhU1R4KUnmqw+kslP1h7YURydh82F3GS2mpK9QplsEYMCiQciKSaivODKx
	 P5UZ5Hzt1pjqDTtmdsmPVYuFfhtaTEdSwL1rjUCwknKYdMdfQfu4Hy8ypOVSS+40cJ
	 4N31FrWU4Gu0nyJjtN+07/ZcndpVYLN+nLKtj+5k=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6FAA2387085F
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=53TR9WeoN+UXqLv6Y9p7DacVz7FR1iK5QN6mHorYZFU=;
 b=aB9t7jQKZ0DDk+CmJHTl+/mYgaxkckeGm+oFMXYDsZyWsIt42ReN3k4RIa7Js0xS1j
 laLGAj3uRKOasDkMYxrOd4zVJhmts75iu++LNWE+jAkQvIhMX+FAncVQ1P1tCBis2cqF
 tW7MldWQP0g8rzp2OexO66DqmeYI+iQj9AQr6b4BrANmybWM4dwqp2bfqZOGwjlPxJSo
 Mn57l0SYxv1WGS9x9o5Sb9mpkbRCplTKA5vt9CjVkAgsekHJjJRQQpdqv0qyp09Av6ab
 H8IMUbkTaSPzgMcyg9aFPS0Tvt30svITSoYLabbGSZ6m7SoL7Hqjvhcbv0TZn90Y28Nm
 UTCA==
X-Gm-Message-State: AOAM53061qVdnsHHQwkEO4awBebLlG7j465onu1nd7MbpRbA7hHFtvQ+
 cAsniyR6bpiics207XoiDL931hlb7P6EksUFJDhIoVX6p0Bd7w==
X-Google-Smtp-Source: ABdhPJwt/WudOdKdYlCtDUX7y3Izor7ddf7F4w5NkPxfpmekX2Pu18GMhPIWtJFzAhf77ZfUDpRm4L2dK53x4PJ+2cI=
X-Received: by 2002:aa7:db88:: with SMTP id u8mr11765851edt.329.1614515299113; 
 Sun, 28 Feb 2021 04:28:19 -0800 (PST)
MIME-Version: 1.0
References: <CAE6_+UewLqP2Tf5FphSqzG21_P-AnXdBjZ+-5-LwJy5n4fXMqg@mail.gmail.com>
 <87zgzo9zpa.fsf@Otto.invalid>
In-Reply-To: <87zgzo9zpa.fsf@Otto.invalid>
Date: Sun, 28 Feb 2021 13:28:08 +0100
Message-ID: <CAE6_+UeJNP_iDG+gSDzNHxDFcnC0mBh2Gj4usU=GGzV1=JtEHg@mail.gmail.com>
Subject: Re: cygwin + binutils 2.36 + ASLR/dynamicbase defaults
To: ASSI <Stromeko@nexgo.de>
X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,
 SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
 server2.sourceware.org
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: Christoph Reiter via Cygwin <cygwin@cygwin.com>
Reply-To: Christoph Reiter <reiter.christoph@gmail.com>
Cc: cygwin@cygwin.com
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: "Cygwin" <cygwin-bounces@cygwin.com>

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