This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ANNOUNCEMENT] TEST RELEASE: Cygwin 2.1.0-0.4


On Jul  7 14:05, Ken Brown wrote:
> On 7/7/2015 11:49 AM, Corinna Vinschen wrote:
> >On Jul  6 18:34, Corinna Vinschen wrote:
> >>On Jul  6 11:54, Ken Brown wrote:
> >>>On 7/6/2015 10:45 AM, Corinna Vinschen wrote:
> >>>>If you want to know how big your current stack *actually* is, you can
> >>>>utilize pthread_getattr_np on Linux and Cygwin, like this:
> >>>>
> >>>>#include <pthread.h>
> >>>>
> >>>>   static void
> >>>>   handle_sigsegv (int sig, siginfo_t *siginfo, void *arg)
> >>>>   {
> >>>>     pthread_attr_t attr;
> >>>>     size_t stacksize;
> >>>>
> >>>>     if (!pthread_getattr_np (pthread_self (), &attr)
> >>>>	&& !pthread_attr_getstacksize (&attr, &stacksize))
> >>>>       {
> >>>>	beg = stack_bottom;
> >>>>	end = stack_bottom + stack_direction * stacksize;
> >>>>
> >>>>	[...]
> >>>>
> >>>>Unfortunately this is non-portable as well, as the trailing _np denotes,
> >>>>but at least there *is* a reliable method on Linux and Cygwin...
> >>>
> >>>Thanks.  That fixes the problem too, even with the call to setrlimit left
> >>>in. I'll report this to the emacs developers.
> >>
> >>Excellent, thanks for testing this!
> >
> >Uh oh.  We have a problem there.  This only worked accidentally, at least
> >on x86_64.  What happens is that pthread_getattr_np checks the validity
> >of the "attr" parameter and while doing so it may (validly) raise a SEGV.
> 
> Yes, I discovered that too.  I was just about to send off an emacs bug
> report and patch, but then I decided to test it once more and got the SEGV.
> [...]
> >As you might have noticed, this has nothing to do with the alternate
> >stack.  It's just YA problem which cropped up during this testphase.
> 
> Yep.  But the good news is that the alternate stack is working.

I spoke too soon.  This *is* a result of the alternate stack handling.
When the exception occurs while running on the alternate stack, the OS
exception handler checks if the stack pointer is valid, and since it's
not in the stackarea as stored in the TEB, it treats the stack as
corrupted.  That's why it stops calling the SEHs.

In the meantime I found a workaround for this problem with only a very
marginal performance hit.  I applied it to the repo and I'm just in the
process of creatsing new snapshots.  If the snapshots work for you I
create another test release.


Thanks,
Corinna

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

Attachment: pgp3uKm1RDfQa.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]