delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/07/17/09:41:44

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 17 Jul 2009 15:41:14 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: perl threads on 2008 R2 64bit = crash ( was: perl 5.10 threads on 1.5.25 = instant crash )
Message-ID: <20090717134114.GX27613@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20090715185636 DOT GA16211 AT ednor DOT casa DOT cgf DOT cx> <4A5E2ED6 DOT 3070502 AT gmail DOT com> <20090715194539 DOT GZ27613 AT calimero DOT vinschen DOT de> <4A5E3F1F DOT 9040103 AT gmail DOT com> <20090716161219 DOT GP27613 AT calimero DOT vinschen DOT de> <4A5F59A1 DOT 1060902 AT gmail DOT com> <20090716195552 DOT GU27613 AT calimero DOT vinschen DOT de> <20090716211823 DOT GC22617 AT ednor DOT casa DOT cgf DOT cx> <20090717085727 DOT GW27613 AT calimero DOT vinschen DOT de> <4A607EE5 DOT 5050306 AT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <4A607EE5.5050306@gmail.com>
User-Agent: Mutt/1.5.19 (2009-02-20)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Jul 17 14:38, Dave Korn wrote:
> Corinna Vinschen wrote:
> > AFAICS, the problem is that _my_tls.el is not the active SEH handler at
> > this point, but it is already part of the chain,
> > _cygtls::init_exception_handler doesn't check for validity and just
> > overwrites the entry in an invalid way.
> 
>   Argh.  Yes, there's no way we can repeatedly enter the same registration
> record into the chain.  I see this has already been anticipated:
> [...]
> > If it's not correct to just skip the OS handlers, we would have to
> > invent a new SEH entry at a lower stack address, rather than reusing
> > the _my_tls entry, which is already in use.
> > 
> > Assuming that skipping the OS handlers is OK, 
> 
>   What if they are try....finally handlers rather than try....except?  Bad
> things might happen?  It might be useful to know what those functions are

If you look again, you see that it's always the same address, always the
same default exception handler in ntdll.dll.  I guess it might be more
correct to add another handler to the chain, rather than to strip the OS
handlers from the chain, but the fact that the OS SEH validity check was
happy with the chain and the testcase worked is kind of relaxing.

> (lookup in windbg?), but then again it might be fragile if we devised a
> solution that relied on that knowledge.  I guess the answer is that if we only
> want a last-chance exception handler we should just make
> _my_tls.init_exception_handler() idempotent so it only installs one handler at
> the start of the chain, but if we want to intercept exceptions ahead of those
> OS handlers (as I think is the intent of the code here) then we need to set up
> and tear down a new SEH record.  The SEH chain has to be a strict stack, with
> entries unlinked in the reverse order to when they're linked; we can't go
> re-ordering it when there are foreign handlers in the mix.

Do we have to take other handlers than the OS handlers and the Cygwin
handlers into account?  Cygwin apps don't install SEH handlers, do
they?  Or do C++ apps?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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