public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/12889] New: Race condition in pthread_kill
@ 2011-06-15  0:39 bugdal at aerifal dot cx
  2011-06-18 23:35 ` [Bug nptl/12889] " ppluzhnikov at google dot com
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: bugdal at aerifal dot cx @ 2011-06-15  0:39 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-09-23  9:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-15  0:39 [Bug nptl/12889] New: Race condition in pthread_kill bugdal at aerifal dot cx
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

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).