Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [patch]: Replace stryoul call to fetch address
Date: Thu, 28 Feb 2013 16:33:00 -0000	[thread overview]
Message-ID: <20130228162005.GE17724@calimero.vinschen.de> (raw)
In-Reply-To: <20130228091853.GB30108@calimero.vinschen.de>

On Feb 28 10:18, Corinna Vinschen wrote:
> On Feb 27 21:50, Pedro Alves wrote:
> > On 02/27/2013 07:42 PM, Corinna Vinschen wrote:
> > 
> > > The SEGV occurs in exception.c, function throw_exception, though.
> > > The `*current_catcher->exception = exception;' assignment crashes
> > > because current_catcher->exception is NULL.  I don't understand yet
> > > why it's NULL, and why the throw_exception function doesn't test
> > > this before trying to write *current_catcher->exception.
> > 
> > What's the backtrace like?
> > 
> > There's always a top level catcher installed (gdb_main -> catch_errors)
> > Unless, hmm, waitaminut.  What's the backtrace like?  I just realized
> > a very early exception in captured_main can result in bad
> > things like that.
> 
> I didn't really debug this in depth yet.  Keep in mind that 64 bit
> Cygwin is still in development so there are heinous bugs to be expected.
> This crash is probably a result of an underlying Cygwin bug.

I debugged this further and it seems this is a bug in newlib's
definition of setjmp_buf:

typedef _JBTYPE sigjmp_buf[_JBLEN+1+(sizeof (sigset_t)/sizeof (_JBTYPE))];

If sizeof(sigset_t) is less than sizeof(_JBTYPE), then the result of the
division is zero, and the buffer is too short by sizeof(sigset_t).
The element preceeding the exception pointer in `struct catcher' is a
sigjmp_buf.  So exception is NULL, because the sigsetjmp call overwrites
exeception with a signal mask.

I'm going to replace the expression in newlib's setjmp.h with

typedef _JBTYPE sigjmp_buf[_JBLEN+1+((sizeof (_JBTYPE) + sizeof (sigset_t) - 1)
                                     /sizeof (_JBTYPE))];

which makes sure that the result of the division is at least 1.  This
change requires to rebuild the toolchain from scratch so it will take
some time to see the result of the change.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat


  reply	other threads:[~2013-02-28 16:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-27 16:44 Corinna Vinschen
2013-02-27 17:20 ` Pedro Alves
2013-02-27 18:47   ` Corinna Vinschen
2013-02-27 19:40     ` Pedro Alves
2013-02-27 19:53       ` Corinna Vinschen
2013-02-27 20:03         ` [patch] gdbserver/win32-low.c: Fix printf-like formatting (was Re: [patch]: Replace stryoul call to fetch address) Corinna Vinschen
2013-02-27 21:05           ` Eli Zaretskii
2013-02-27 21:25             ` Corinna Vinschen
2013-02-27 21:30               ` Eli Zaretskii
2013-02-28  9:19                 ` Corinna Vinschen
2013-02-28 16:20                   ` Eli Zaretskii
2013-02-27 21:50           ` Pedro Alves
2013-02-28 11:01             ` Corinna Vinschen
2013-02-28  0:44         ` [patch]: Replace stryoul call to fetch address Pedro Alves
2013-02-28 10:02           ` Corinna Vinschen
2013-02-28 16:33             ` Corinna Vinschen [this message]
2013-02-28 16:48               ` Corinna Vinschen
2013-02-28 17:04                 ` Pedro Alves
2013-02-27 20:24   ` Christopher Faylor
2013-02-27 20:29     ` Christopher Faylor
2013-02-28  0:33       ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130228162005.GE17724@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox