mailing list of musl libc
 help / color / mirror / code / Atom feed
* [proposal] Add detection of thread ID in pthread-related interfaces
@ 2019-06-11 11:36 pengyuanhong
  2019-06-11 13:57 ` Szabolcs Nagy
  2019-06-11 16:09 ` Rich Felker
  0 siblings, 2 replies; 6+ messages in thread
From: pengyuanhong @ 2019-06-11 11:36 UTC (permalink / raw)
  To: musl
  Cc: helitao, Huangqiang (H), Jinyongming, leijitang, liuyutao (C),
	Liyu (Marvin, Euler Dept), Threefifteen Wang(Kunfeng),
	Wudilong (Michael)

[-- Attachment #1: Type: text/plain, Size: 668 bytes --]

Hello,

I find that all pthread-related interfaces directly access the input
parameter `pthread_t` without any check. If I pass an invalid thread ID
(e.g. an exited thread ID) to these interfaces, then segment fault
happens.

Both glibc and freebsd can do simple detection of thread ID(pthread_t)
passed by user and return ESRCH when no thread can be found. They
put all threads in a list or hash table, and update this list or table every
time a thread is created or exits.

From the user's point of view, segment fault is unbearable and is not
*         recoverable in most cases. Instead, returning an error of ESRCH
*         seems more acceptable.

[-- Attachment #2: Type: text/html, Size: 7202 bytes --]

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

end of thread, other threads:[~2019-06-11 16:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-11 11:36 [proposal] Add detection of thread ID in pthread-related interfaces pengyuanhong
2019-06-11 13:57 ` Szabolcs Nagy
2019-06-11 14:36   ` Rich Felker
2019-06-11 15:58     ` Li Yu
2019-06-11 16:15       ` Rich Felker
2019-06-11 16:09 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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