delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/02/28/23:17:08

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C9C3388C039
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1614572222;
bh=9maijM5e9UKmM3IHZrTEbc3M15XjZLLNCkkpIXWfz/w=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=inuQ3gODVAMDOMFIarTlvtErE1sYGbsjEuWIanaDqzmxI+BiG8QEfIO7oNLkr0UJI
xyIwViv1kis7jADniKtil0hcwx+oGgejax87VvzWekdyyMvGpQ7lF84oOjBgCyKO88
22h7NBb8zKjN0z2P8Y7PKbP71cHwpNjnkdW3D+Ks=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5CD01384640D
Date: Sun, 28 Feb 2021 20:16:56 -0800 (PST)
X-X-Sender: jeremyd AT resin DOT csoft DOT net
To: cygwin AT cygwin DOT com
Subject: Re: cygwin + binutils 2.36 + ASLR/dynamicbase defaults
In-Reply-To: <87zgzo9zpa.fsf@Otto.invalid>
Message-ID: <alpine.BSO.2.21.2102281958220.9707@resin.csoft.net>
References: <CAE6_+UewLqP2Tf5FphSqzG21_P-AnXdBjZ+-5-LwJy5n4fXMqg AT mail DOT gmail DOT com>
<87zgzo9zpa DOT fsf AT Otto DOT invalid>
User-Agent: Alpine 2.21 (BSO 202 2017-01-01)
MIME-Version: 1.0
X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW,
SPF_HELO_PASS, 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 AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Jeremy Drake via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Jeremy Drake <cygwin AT jdrake DOT com>
Cc: ASSI <Stromeko AT nexgo DOT de>
Errors-To: cygwin-bounces AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--25400436588544-707386150-1614572217=:9707
Content-Type: text/plain; charset=US-ASCII

On Sun, 28 Feb 2021, ASSI wrote:

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

Well, Microsoft's LINK.EXE and LLVM's LLD have already been using these
new defaults for some time.  But I was surprised how quickly my patch was
accepted/merged.

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

To clarify, default base addresses should not have changed for cygwin
targets, they were already above 4GB.

I have a prelimiary patch that I plan to send upstream once I get some
testing done on it, which reverts the default dll characteristics for
cygwin targets.  I don't know if what you've done to 'nix it' for Cygwin
was similar.

I have not seen anything one way or the other on the NXCOMPAT flag.  Does
that also needs to be reverted for Cygwin?

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

I have seen the issues you described on 32-bit, but my understanding of
how ASLR works suggested that it should be very rare on 64-bit.

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

... but now that you mention the stack moving, yes, I could see that
being an issue.

Yes, the specific field where these flags are stored is called "DLL
Characteristics" so that is how it was referred to, but they do not
exclusively apply to DLLs.

https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#dll-characteristics
--25400436588544-707386150-1614572217=:9707
Content-Type: text/plain; charset=US-ASCII; name=0001-ld-revert-default-dll-characteristics-for-Cygwin.patch
Content-Transfer-Encoding: BASE64
Content-ID: <alpine DOT BSO DOT 2 DOT 21 DOT 2102282016560 DOT 9707 AT resin DOT csoft DOT net>
Content-Description: 
Content-Disposition: attachment; filename=0001-ld-revert-default-dll-characteristics-for-Cygwin.patch

RnJvbSAzOWJkZTJmMTFhMWViOTc1MDNiYWU5Y2YxNWY1ZmMwNTY0MGU1MjUx
IE1vbiBTZXAgMTcgMDA6MDA6MDAgMjAwMQ0KRnJvbTogSmVyZW15IERyYWtl
IDxzb3VyY2V3YXJlLWJ1Z3ppbGxhQGpkcmFrZS5jb20+DQpEYXRlOiBTdW4s
IDI4IEZlYiAyMDIxIDE1OjQ5OjA4IC0wODAwDQpTdWJqZWN0OiBbUEFUQ0hd
IGxkOiByZXZlcnQgZGVmYXVsdCBkbGwgY2hhcmFjdGVyaXN0aWNzIGZvciBD
eWd3aW4uDQoNCk1haWwgdGhyZWFkIGZyb20NCmh0dHBzOi8vY3lnd2luLmNv
bS9waXBlcm1haWwvY3lnd2luLzIwMjEtRmVicnVhcnkvMjQ3OTIyLmh0bWwg
c3VnZ2VzdHMNCnRoZXNlIGZsYWdzIHdpbGwgTk9UIHdvcmsgZm9yIEN5Z3d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TF9BVVRPX0lNQUdFX01B
U0sgXA0KLSAgKChiZmRfdm1hKSAoJHttb3ZlX2RlZmF1bHRfYWRkcl9oaWdo
fSA/IDB4MGZmZmYwMDAwTEwgXA0KLQkJCQkJOiAweDBmZmMwMDAwTEwpKQ0K
KyAgKChiZmRfdm1hKSAoJHtjeWd3aW5fYmVoYXZpb3J9ID8gMHgwZmZmZjAw
MDBMTCBcDQorCQkJCSA6IDB4MGZmYzAwMDBMTCkpDQogI3VuZGVmICBQRV9E
RUZfU0VDVElPTl9BTElHTk1FTlQNCiAjZGVmaW5lCVBFX0RFRl9TVUJTWVNU
RU0JCTINCiAjdW5kZWYgIFBFX0RFRl9GSUxFX0FMSUdOTUVOVA0KLS0gDQoy
LjMwLjEud2luZG93cy4xDQoNCg==

--25400436588544-707386150-1614572217=:9707
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--25400436588544-707386150-1614572217=:9707--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019