public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bugdal at aerifal dot cx" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug nptl/12889] New: Race condition in pthread_kill
Date: Wed, 15 Jun 2011 00:39:00 -0000	[thread overview]
Message-ID: <bug-12889-131@http.sourceware.org/bugzilla/> (raw)

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

           Summary: Race condition in pthread_kill
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: bugdal@aerifal.cx


There is a race condition in pthread_kill: it is possible that, between the
time pthread_kill reads the pid/tid from the target thread descriptor and the
time it makes the tgkill syscall, the target thread terminates and the same tid
gets assigned to a new thread in the same process.

(The tgkill syscall was designed to eliminate a similar race condition in
tkill, but it only succeeded in eliminating races where the tid gets reused in
a different process, and does not help if the same tid gets assigned to a new
thread in the same process.)

The only solution I can see is to introduce a mutex that ensures that a thread
cannot exit while pthread_kill is being called on it.

Note that in most real-world situations, like almost all race conditions, this
one will be extremely rare. To make it measurable, one could exhaust all but
1-2 available pid values, possibly by lowering the max pid parameter in /proc,
forcing the same tid to be reused rapidly.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


             reply	other threads:[~2011-06-15  0:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15  0:39 bugdal at aerifal dot cx [this message]
2011-06-18 23:35 ` [Bug nptl/12889] " ppluzhnikov at google dot com
2012-04-29  3:04 ` bugdal at aerifal dot cx
2014-06-27 13:11 ` fweimer at redhat dot com
2015-10-31 12:08 ` fweimer at redhat dot com
2015-10-31 12:37 ` schwab@linux-m68k.org
2015-10-31 20:27 ` bugdal at aerifal dot cx
2021-08-17  6:25 ` fweimer at redhat dot com
2021-08-17 12:01 ` fweimer at redhat dot com
2021-08-17 12:44 ` fweimer at redhat dot com
2021-08-17 13:52 ` fweimer at redhat dot com
2021-09-13 10:41 ` cvs-commit at gcc dot gnu.org
2021-09-13 10:46 ` fweimer at redhat dot com
2021-09-13 12:20 ` cvs-commit at gcc dot gnu.org
2021-09-21 13:05 ` fweimer at redhat dot com
2021-09-23  8:54 ` cvs-commit at gcc dot gnu.org
2021-09-23  9:04 ` cvs-commit at gcc dot gnu.org

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=bug-12889-131@http.sourceware.org/bugzilla/ \
    --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).