public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/19193] New: pthread_kill returns ESRCH for a thread ID whose lifetime has not ended
@ 2015-10-31 11:42 fweimer at redhat dot com
  2021-08-17  6:23 ` [Bug nptl/19193] " fweimer at redhat dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2015-10-31 11:42 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19193

            Bug ID: 19193
           Summary: pthread_kill returns ESRCH for a thread ID whose
                    lifetime has not ended
           Product: glibc
           Version: 2.23
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
          Assignee: unassigned at sourceware dot org
          Reporter: fweimer at redhat dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---
             Flags: security-

POSIX specifies that the lifetime of a thread ID ends when it terminates and it
is detached or joined (or immediately at creation when it is created already
detached).

POSIX does not specify the ESRCH return value for pthread_kill in case the
thread has exited, only if the lifetime of the thread ID has ended (as an
option).  In analogy with the specification of kill and process lifetime,
threads which have exited should not cause pthread_kill to return ESRCH.

I think pthread_kill has to ignore the ESRCH error from the system call.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug nptl/19193] pthread_kill returns ESRCH for a thread ID whose lifetime has not ended
  2015-10-31 11:42 [Bug nptl/19193] New: pthread_kill returns ESRCH for a thread ID whose lifetime has not ended fweimer at redhat dot com
@ 2021-08-17  6:23 ` fweimer at redhat dot com
  2021-08-17  6:25 ` fweimer at redhat dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2021-08-17  6:23 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19193

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com

--- Comment #2 from Florian Weimer <fweimer at redhat dot com> ---
With the changed pthread_cancel implementation in glibc 2.34, pthread_cancel
can now fail with ESRCH, too.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug nptl/19193] pthread_kill returns ESRCH for a thread ID whose lifetime has not ended
  2015-10-31 11:42 [Bug nptl/19193] New: pthread_kill returns ESRCH for a thread ID whose lifetime has not ended fweimer at redhat dot com
  2021-08-17  6:23 ` [Bug nptl/19193] " fweimer at redhat dot com
@ 2021-08-17  6:25 ` fweimer at redhat dot com
  2021-08-17 12:01 ` fweimer at redhat dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2021-08-17  6:25 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19193

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #3 from Florian Weimer <fweimer at redhat dot com> ---
Bug 12889 is essentially the same bug, I think.

*** This bug has been marked as a duplicate of bug 12889 ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug nptl/19193] pthread_kill returns ESRCH for a thread ID whose lifetime has not ended
  2015-10-31 11:42 [Bug nptl/19193] New: pthread_kill returns ESRCH for a thread ID whose lifetime has not ended fweimer at redhat dot com
  2021-08-17  6:23 ` [Bug nptl/19193] " fweimer at redhat dot com
  2021-08-17  6:25 ` fweimer at redhat dot com
@ 2021-08-17 12:01 ` fweimer at redhat dot com
  2021-08-17 12:01 ` fweimer at redhat dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2021-08-17 12:01 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19193

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|DUPLICATE                   |---
             Status|RESOLVED                    |REOPENED
           Assignee|unassigned at sourceware dot org   |fweimer at redhat dot com

--- Comment #4 from Florian Weimer <fweimer at redhat dot com> ---
We need to fix this bug separately.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug nptl/19193] pthread_kill returns ESRCH for a thread ID whose lifetime has not ended
  2015-10-31 11:42 [Bug nptl/19193] New: pthread_kill returns ESRCH for a thread ID whose lifetime has not ended fweimer at redhat dot com
                   ` (2 preceding siblings ...)
  2021-08-17 12:01 ` fweimer at redhat dot com
@ 2021-08-17 12:01 ` fweimer at redhat dot com
  2021-08-17 12:01 ` [Bug nptl/19193] pthread_kill, pthread_cancel return " fweimer at redhat dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2021-08-17 12:01 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19193

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |ASSIGNED

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug nptl/19193] pthread_kill, pthread_cancel return ESRCH for a thread ID whose lifetime has not ended
  2015-10-31 11:42 [Bug nptl/19193] New: pthread_kill returns ESRCH for a thread ID whose lifetime has not ended fweimer at redhat dot com
                   ` (3 preceding siblings ...)
  2021-08-17 12:01 ` fweimer at redhat dot com
@ 2021-08-17 12:01 ` fweimer at redhat dot com
  2021-08-17 12:45 ` fweimer at redhat dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2021-08-17 12:01 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19193

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|pthread_kill returns ESRCH  |pthread_kill,
                   |for a thread ID whose       |pthread_cancel return ESRCH
                   |lifetime has not ended      |for a thread ID whose
                   |                            |lifetime has not ended

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug nptl/19193] pthread_kill, pthread_cancel return ESRCH for a thread ID whose lifetime has not ended
  2015-10-31 11:42 [Bug nptl/19193] New: pthread_kill returns ESRCH for a thread ID whose lifetime has not ended fweimer at redhat dot com
                   ` (4 preceding siblings ...)
  2021-08-17 12:01 ` [Bug nptl/19193] pthread_kill, pthread_cancel return " fweimer at redhat dot com
@ 2021-08-17 12:45 ` fweimer at redhat dot com
  2021-08-17 13:52 ` fweimer at redhat dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2021-08-17 12:45 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19193

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://bugzilla.redhat.com
                   |                            |/show_bug.cgi?id=1994068

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug nptl/19193] pthread_kill, pthread_cancel return ESRCH for a thread ID whose lifetime has not ended
  2015-10-31 11:42 [Bug nptl/19193] New: pthread_kill returns ESRCH for a thread ID whose lifetime has not ended fweimer at redhat dot com
                   ` (5 preceding siblings ...)
  2021-08-17 12:45 ` fweimer at redhat dot com
@ 2021-08-17 13:52 ` fweimer at redhat dot com
  2021-09-13 10:46 ` fweimer at redhat dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2021-08-17 13:52 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19193

--- Comment #5 from Florian Weimer <fweimer at redhat dot com> ---
Patches posted:
https://sourceware.org/pipermail/libc-alpha/2021-August/130207.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug nptl/19193] pthread_kill, pthread_cancel return ESRCH for a thread ID whose lifetime has not ended
  2015-10-31 11:42 [Bug nptl/19193] New: pthread_kill returns ESRCH for a thread ID whose lifetime has not ended fweimer at redhat dot com
                   ` (6 preceding siblings ...)
  2021-08-17 13:52 ` fweimer at redhat dot com
@ 2021-09-13 10:46 ` fweimer at redhat dot com
  2021-09-17 11:29 ` fweimer at redhat dot com
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2021-09-13 10:46 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19193

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.35
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Florian Weimer <fweimer at redhat dot com> ---
Fixed for 2.35 via:

commit 8af8456004edbab71f8903a60a3cae442cf6fe69
Author: Florian Weimer <fweimer@redhat.com>
Date:   Mon Sep 13 11:06:08 2021 +0200

    nptl: pthread_kill, pthread_cancel should not fail after exit (bug 19193)

    This closes one remaining race condition related to bug 12889: if
    the thread already exited on the kernel side, returning ESRCH
    is not correct because that error is reserved for the thread IDs
    (pthread_t values) whose lifetime has ended.  In case of a
    kernel-side exit and a valid thread ID, no signal needs to be sent
    and cancellation does not have an effect, so just return 0.

    sysdeps/pthread/tst-kill4.c triggers undefined behavior and is
    removed with this commit.

    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug nptl/19193] pthread_kill, pthread_cancel return ESRCH for a thread ID whose lifetime has not ended
  2015-10-31 11:42 [Bug nptl/19193] New: pthread_kill returns ESRCH for a thread ID whose lifetime has not ended fweimer at redhat dot com
                   ` (7 preceding siblings ...)
  2021-09-13 10:46 ` fweimer at redhat dot com
@ 2021-09-17 11:29 ` fweimer at redhat dot com
  2021-09-20 12:58 ` cvs-commit at gcc dot gnu.org
  2021-09-20 13:49 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2021-09-17 11:29 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19193

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://bugzilla.redhat.com
                   |                            |/show_bug.cgi?id=2005142

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug nptl/19193] pthread_kill, pthread_cancel return ESRCH for a thread ID whose lifetime has not ended
  2015-10-31 11:42 [Bug nptl/19193] New: pthread_kill returns ESRCH for a thread ID whose lifetime has not ended fweimer at redhat dot com
                   ` (8 preceding siblings ...)
  2021-09-17 11:29 ` fweimer at redhat dot com
@ 2021-09-20 12:58 ` cvs-commit at gcc dot gnu.org
  2021-09-20 13:49 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-20 12:58 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19193

--- Comment #7 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Florian Weimer <fw@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=95dba35bf05e4a5d69dfae5e9c9d4df3646a7f93

commit 95dba35bf05e4a5d69dfae5e9c9d4df3646a7f93
Author: Florian Weimer <fweimer@redhat.com>
Date:   Mon Sep 20 14:56:08 2021 +0200

    nptl: pthread_kill needs to return ESRCH for old programs (bug 19193)

    The fix for bug 19193 breaks some old applications which appear
    to use pthread_kill to probe if a thread is still running, something
    that is not supported by POSIX.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug nptl/19193] pthread_kill, pthread_cancel return ESRCH for a thread ID whose lifetime has not ended
  2015-10-31 11:42 [Bug nptl/19193] New: pthread_kill returns ESRCH for a thread ID whose lifetime has not ended fweimer at redhat dot com
                   ` (9 preceding siblings ...)
  2021-09-20 12:58 ` cvs-commit at gcc dot gnu.org
@ 2021-09-20 13:49 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-20 13:49 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19193

--- Comment #8 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The release/2.34/master branch has been updated by Florian Weimer
<fw@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=73c7f5a87971de2797f261e1a447f68dce09284b

commit 73c7f5a87971de2797f261e1a447f68dce09284b
Author: Florian Weimer <fweimer@redhat.com>
Date:   Mon Sep 20 14:56:08 2021 +0200

    nptl: pthread_kill needs to return ESRCH for old programs (bug 19193)

    The fix for bug 19193 breaks some old applications which appear
    to use pthread_kill to probe if a thread is still running, something
    that is not supported by POSIX.

    (cherry picked from commit 95dba35bf05e4a5d69dfae5e9c9d4df3646a7f93)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2021-09-20 13:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-31 11:42 [Bug nptl/19193] New: pthread_kill returns ESRCH for a thread ID whose lifetime has not ended fweimer at redhat dot com
2021-08-17  6:23 ` [Bug nptl/19193] " fweimer at redhat dot com
2021-08-17  6:25 ` fweimer at redhat dot com
2021-08-17 12:01 ` fweimer at redhat dot com
2021-08-17 12:01 ` fweimer at redhat dot com
2021-08-17 12:01 ` [Bug nptl/19193] pthread_kill, pthread_cancel return " fweimer at redhat dot com
2021-08-17 12:45 ` fweimer at redhat dot com
2021-08-17 13:52 ` fweimer at redhat dot com
2021-09-13 10:46 ` fweimer at redhat dot com
2021-09-17 11:29 ` fweimer at redhat dot com
2021-09-20 12:58 ` cvs-commit at gcc dot gnu.org
2021-09-20 13:49 ` 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).