From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80778 invoked by alias); 28 Feb 2019 13:12:39 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 80766 invoked by uid 89); 28 Feb 2019 13:12:39 -0000 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 Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (212.227.126.187) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 28 Feb 2019 13:12:38 +0000 Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MC2k1-1grOTn1oE9-00COIZ; Thu, 28 Feb 2019 14:12:34 +0100 Received: by calimero.vinschen.de (Postfix, from userid 500) id C28C1A8093E; Thu, 28 Feb 2019 14:12:33 +0100 (CET) Date: Thu, 28 Feb 2019 18:01:00 -0000 From: Corinna Vinschen To: "E. Madison Bray" Cc: cygwin@cygwin.com Subject: Re: Consider exposing mmap_is_attached_or_noreserve Message-ID: <20190228131233.GI4133@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: "E. Madison Bray" , cygwin@cygwin.com References: <20190227161712.GB4133@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="EyuBRJR0MsVMWKTf" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-SW-Source: 2019-02/txt/msg00499.txt.bz2 --EyuBRJR0MsVMWKTf Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2818 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" Content-length: 833 -----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--