public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "batneil at thebatcave dot org dot uk" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug nptl/2644] New: Race condition during unwind code after thread cancellation
Date: Sun, 07 May 2006 13:56:00 -0000	[thread overview]
Message-ID: <20060507135630.2644.batneil@thebatcave.org.uk> (raw)

I think there is a race condition in the code in
nptl/sysdeps/pthread/unwind-forcedunwind.c which can lead to a segfault.  I
found this in a redhat build, but it exists in CVS glibc too (as of May 6 2006).

Consider a call to _Unwind_ForcedUnwind, when libgcc_s_forcedunwind has not been
loaded.  _Unwind_ForcedUnwind checks the value against null, and jumps to
pthread_cancel_init.  Meanwhile another thread comes in and initialises all
these pointers, so the first check in pthread_cancel_init shows that
libgcc_s_getcfa is non-null, so we return to _Unwind_ForcedUnwind and execute
libgcc_s_forcedunwind.  As the function pointer libgcc_s_forcedunwind has not
been marked volatile, the compiler does not need to reload this value, and
attempts to call the address it previously loaded, ie. 0.

I have a test case which shows the problem and patch which I believe fixes it.

-- 
           Summary: Race condition during unwind code after thread
                    cancellation
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
        AssignedTo: drepper at redhat dot com
        ReportedBy: batneil at thebatcave dot org dot uk
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: i686-redhat-linux
  GCC host triplet: i686-redhat-linux
GCC target triplet: i686-redhat-linux


http://sourceware.org/bugzilla/show_bug.cgi?id=2644

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


             reply	other threads:[~2006-05-07 13:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-07 13:56 batneil at thebatcave dot org dot uk [this message]
2006-05-07 14:02 ` [Bug nptl/2644] " batneil at thebatcave dot org dot uk
2006-05-07 14:05 ` batneil at thebatcave dot org dot uk
2006-05-07 14:14 ` batneil at thebatcave dot org dot uk
2006-05-07 17:33 ` drepper at redhat dot com
2006-05-07 18:37 ` batneil at thebatcave dot org dot uk
2006-05-07 22:15 ` batneil at thebatcave dot org dot uk
2006-05-07 22:19 ` batneil at thebatcave dot org dot uk
2006-05-08  1:00 ` drepper at redhat dot com
2006-05-08  9:36 ` batneil at thebatcave dot org dot uk
2006-05-08 11:28 ` jakub at redhat dot com
2006-11-28 10:31 ` jakub at redhat dot com

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=20060507135630.2644.batneil@thebatcave.org.uk \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).