delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/02/28/08:12:50

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:cc:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=AOoNMs+1hqYX7mzv8Bu6XfJFWT69HIXuxrAl5hCPfpdwa8Jhvfn7k
XVUthZK/AVTaLORWg4/zKi4tqKABCjRQQxN7WTUvwQ/tdFDtQQeTdQP8aChXGHc4
b6Zgl78Yvjc5qTopFt66+dUHhAgKl6EKRUJ/AY849sL2oqj8qt69Ms=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:cc:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=kqftMHWewHOs7P1Lm/KPnnxkt94=; b=m8291NbXlE40e8XsV0/7nlyarCP1
o04eLOZe3WUgVD6Lg4/vGtlWDTq2jVgtzksdkE2GzdSwuwgUoi5bbhjGtxqnNUTy
h/jcfdlwqG+UZbzQKMZz12gdO2LDCL8Jy/fZhUtQkcGU5N/zxz69Bmqu02yTQERe
2T6nCFrvKHoVN+w=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-100.9 required=5.0 tests=BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=slippery, cool, month, protect
X-HELO: mout.kundenserver.de
Date: Thu, 28 Feb 2019 14:12:33 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: "E. Madison Bray" <erik DOT m DOT bray AT gmail DOT com>
Cc: cygwin AT cygwin DOT com
Subject: Re: Consider exposing mmap_is_attached_or_noreserve
Message-ID: <20190228131233.GI4133@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: "E. Madison Bray" <erik DOT m DOT bray AT gmail DOT com>, cygwin AT cygwin DOT com
References: <CAOTD34a-hdE0Jx=7HjB3CMYqgVr6m7Xo39YcmjeL0=43Opjkjg AT mail DOT gmail DOT com> <20190227161712 DOT GB4133 AT calimero DOT vinschen DOT de> <CAOTD34Y5F0cm7bVMiTYqA91tn7i9QZ_zLseMERmQnKp=MJqvqA AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAOTD34Y5F0cm7bVMiTYqA91tn7i9QZ_zLseMERmQnKp=MJqvqA@mail.gmail.com>
User-Agent: Mutt/1.11.3 (2019-02-01)

--EyuBRJR0MsVMWKTf
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Feb 28 12:50, E. Madison Bray wrote:
> On Wed, Feb 27, 2019 at 5:17 PM Corinna Vinschen wrote:
> >
> > On Feb 27 16:38, E. Madison Bray wrote:
> > > In order to handle such a case it might be nice if
> > > mmap_is_attached_or_noreserve were able to be called by user code,
> > > perhaps as a new cygwin_internal(...) call.  I'd happily provide a
> > > patch, but I fear this might be an X/Y problem that I'm not seeing.
> >
> > Honestly, I'm not overly keen to expose this stuff.  Wouldn't it
> > make more sense to fix Cygwin's sigaltstack implementation to handle
> > these cases gracefully?  You're apparently not shy working with
> > Windows exception handling.  Patches more than welcome!  I'm not
> > happy not having found a solution to this problem :}
>=20
> I can theoretically imagine a case where might be a problem totally
> outside the context of the altstack issue: e.g. maybe a cygwin
> application that has to link with a native Windows DLL that happens to
> register some vectored continue handler that does something with
> STATUS_ACCESS_VIOLATION exceptions.  Of course, absent a real example
> I wouldn't push for it.

A Cygwin application creating a vectored exception handler is not really
a Cygwin application since that circumvents Cygwin's exeception and
signal handling.  Even if Cygwin's handling isn't entirely foolproof,
that's a slippery slope.

> I completely agree it would be better to have a solution to the actual  p=
roblem.
>=20
> > Oh, wait!  Maybe there is a simple solution.  Patch 9a5abcc896bd
> > added a single line
> >
> >   exception protect;
> >
> > to the pthread::thread_init_wrapper method.
> >
> > What if adding the same line to the altstack_wrapper function
> > would help for altstack as well?
>=20
> You know, I actually noticed this just recently, because I noticed
> that pthreads also run on a stack allocated by Cygwin, and I wondered
> how exception handling would work in that case.  I think I was looking
> at it in the context of the thread last month that resulted in that
> fix, but I forgot to ask you if this could work for the altstack issue
> as well.

No worries, we can't fix all problems at one :}

> > Can you test this?
>=20
> I'll give it a try and report back with a patch if it works.

That would be way cool.  I'm looking forward to it.

> The biggest risk is if a stack overflow happens while running on the
> altstack--in this case even the Cygwin exception handling could fail
> and the application will just crash.  But for other, less extreme
> cases having this would be better than nothing.

Stack overflow is nasty.  You're aware of the special concession for
this case in altstack_wrapper(), right?  It's not exacly what happens
on Linux, but it's at least some clean way out.


Corinna

--=20
Corinna Vinschen
Cygwin Maintainer

--EyuBRJR0MsVMWKTf
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlx33kEACgkQ9TYGna5E
T6BVBQ/9Eml0F1sKNOE1uPApNHakitWQNAvI51DojQLPt6q1yXSUH6ZpOpT/uj4L
rEi97NbjxOzyPL1PQEhBVN/a94MC6jrUGUR9TPK/fthlneYCT5nL32zLQIFZd+gp
aFNN+2FuxzYMP77ItHWps2NKWgl8yWJQ0W3OkFM5ch9z63tCL0YQQgqqXj83d7PI
8ks+8N50AZ0F28DsTGHgMUwt0nUHs2LPgh+CGmaHTwyWjVWEK02ATKRZhxNXMcK2
vXIAQa3e0mzxUbvmhDIslYqCE4bQZ1gpf1X0OiZJUWeHncAzUG2LEGnxhc86nFMQ
9yAL/5ABplFzqkf5p9bnDxA5n5AgonFAkiiMCgyvZQz2s4NrmyK3333jGBySLffF
rn9AW6RpDDcFaeMyr1/b8lHVWcqjKBhjQau844qYpGEy3x5Ygy179WKbrY+sX8Lo
myReJRsDw3o/Ab6tecAzjatXW7IXrWOLB8k3lC5esi3CO4Key5Mm6f1xlqtWfi1y
I4KbYlN/zxgnyv8k9+6EdAFAVp2HcLP6hsi8QgpiKSgmIvyLeiztOF/WwFdEmuDI
U9m+zAo2XC3iggVj0EG6ka1VgisP3APqZM4XvKYSiwl2Tq9YoM3FH2FHewQYdWJh
V1Yrv0/sYDcEIwzNFCz+XUMegEisWiEW7y2Dq/CRb1LM6uyKcfU=
=1Cmi
-----END PGP SIGNATURE-----

--EyuBRJR0MsVMWKTf--

- Raw text -


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