Linux-man Archive on lore.kernel.org
 help / color / 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, back to index

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

Linux-man Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-man/0 linux-man/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-man linux-man/ https://lore.kernel.org/linux-man \
		linux-man@vger.kernel.org
	public-inbox-index linux-man

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-man


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git