pthread_set_name_np() previously allowed a NULL pointer to clear the thread name. In FreeBSD 12.0, the library will dereference the null pointer, leading to a segment violation. In /usr/src/lib/libthr/thread/thr_info.c, we have: static void thr_set_name_np(struct pthread *thread, const char *name) { free(thread->name); thread->name = strdup(name); } The last line of the function should more correctly be: thread->name = name ? strdup(name) : NULL;
A commit references this bug: Author: kib Date: Thu Jul 11 16:19:33 UTC 2019 New revision: 349912 URL: https://svnweb.freebsd.org/changeset/base/349912 Log: Restore ability to pass NULL name argument to pthread_set_name_np(3) to clear the thread name. PR: 239142 Submitted by: Lewis Donzis <lew@perftech.com> MFC after: 3 days Changes: head/lib/libthr/thread/thr_info.c
A commit references this bug: Author: kib Date: Sun Jul 14 05:39:03 UTC 2019 New revision: 349982 URL: https://svnweb.freebsd.org/changeset/base/349982 Log: MFC r349912: Restore ability to pass NULL name argument to pthread_set_name_np(3) to clear the thread name. PR: 239142 Changes: _U stable/12/ stable/12/lib/libthr/thread/thr_info.c
A commit references this bug: Author: kib Date: Sun Jul 14 05:41:14 UTC 2019 New revision: 349984 URL: https://svnweb.freebsd.org/changeset/base/349984 Log: MFC r349912: Restore ability to pass NULL name argument to pthread_set_name_np(3) to clear the thread name. PR: 239142 Changes: _U stable/11/ stable/11/lib/libthr/thread/thr_info.c