linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
To: enh <enh@google.com>
Cc: "Michael Kerrisk \(man-pages\)" <mtk.manpages@gmail.com>,
	linux-man@vger.kernel.org
Subject: Re: [PATCH] pthread_kill.3: Update to match POSIX.
Date: Tue, 12 Nov 2019 23:28:49 +0100	[thread overview]
Message-ID: <87imnobufy.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <CAJgzZorosDN58Zp6TUDJbzY3fmR-rJeWbELtw_H3nzMyaWondg@mail.gmail.com> (enh's message of "Tue, 12 Nov 2019 14:22:44 -0800")

* enh:

> but this is all about *invalid* threads, which obviously can't be
> joinable. i'm really not sure what you're trying to say.

Uhm, people try use pthread_kill to probe for thread termination.
Termintation of a non-detached thread doesn't make a thread
non-joinable, so from a temporal memory safety perspective, that's
totally fine.  Except that POSIX requires implementations to hide this
information from callers.

Maybe we are talking past each other, though.

Let's look at what musl does:

int pthread_kill(pthread_t t, int sig)
{
        int r;
        LOCK(t->killlock);
        r = t->tid ? -__syscall(SYS_tkill, t->tid, sig)
                : (sig+0U >= _NSIG ? EINVAL : 0);
        UNLOCK(t->killlock);
        return r;
}

The 0 could be ESRCH to support probing for termination.

  reply	other threads:[~2019-11-12 22:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 20:36 [PATCH] pthread_kill.3: Update to match POSIX enh
2019-11-12 21:38 ` Florian Weimer
2019-11-12 21:40   ` enh
2019-11-12 21:52     ` Florian Weimer
2019-11-12 22:06       ` enh
2019-11-12 22:11         ` Florian Weimer
2019-11-12 22:22           ` enh
2019-11-12 22:28             ` Florian Weimer [this message]
2019-11-13  5:27               ` enh
2019-11-13  5:51                 ` Florian Weimer
2019-11-13  5:59                   ` enh
2019-11-13  6:10                     ` Florian Weimer
2021-11-09 23:00                       ` enh
2021-11-10  7:14                         ` Florian Weimer
2021-11-12  0:01                           ` enh
2021-11-12 13:02                             ` Florian Weimer

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=87imnobufy.fsf@mid.deneb.enyo.de \
    --to=fw@deneb.enyo.de \
    --cc=enh@google.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.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 NNTP newsgroup(s).