linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Remove ESRCH from pthread_* man pages or document it as nonstandard
@ 2020-02-10 20:28 Rich Felker
  0 siblings, 0 replies; only message in thread
From: Rich Felker @ 2020-02-10 20:28 UTC (permalink / raw)
  To: Michael Kerrisk (man-pages); +Cc: linux-man

Use of a pthread_t after its lifetime has ended is undefined behavior.
Pre-2008 POSIX wrongly had ESRCH errors specified for a number of
interfaces, conflicting with explicitly making such use UB; this was
fixed as a result of Austin Group interpretation 142:

https://collaboration.opengroup.org/austin/interps/documents/14366/AI-142.txt

However, the man pages still have ESRCH listed for most if not all of
the pthread_* interfaces that take a pthread_t argument.

Could this be removed, or annotated to clarify that (1) this is not
standard/portable behavior programmers can rely on (FYI: musl does not
do it), and (2) like all instances of the pattern "use of resource
identifier after the resource it refers to has been released/freed",
passing a pthread_t whose lifetime may have ended is inherently a bug.

This came up again on the musl mailing list today:

https://www.openwall.com/lists/musl/2020/02/10/3

Rich

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-10 20:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10 20:28 Remove ESRCH from pthread_* man pages or document it as nonstandard Rich Felker

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