Hi, The current implementation does not check for NULL attr values and segfaults when creating new threads if that's the case:
Program received signal SIGSEGV, Segmentation fault. 0x00000a77e9550ade in pthread_create (threadp=0x7f7ffffe5488, attr=0x7f7ffffe5480, start_routine=0xa7539a00600 <a_thread_func>, arg=<optimized out>) at /usr/src/lib/librthread/rthread.c:370 370 thread->attr = attr != NULL ? *(*attr) : _rthread_attr_default; (gdb) p attr $1 = (const pthread_attr_t *) 0x7f7ffffe5480 (gdb) p *attr $2 = (const pthread_attr_t) 0x0 The diff bellow fixes the issue by checking *attr and returning EINVAL if it is NULL. OK? (Surprisingly the manual already documents this.) Paul Index: rthread.c =================================================================== RCS file: /cvs/src/lib/librthread/rthread.c,v retrieving revision 1.99 diff -u -p -u -p -r1.99 rthread.c --- rthread.c 4 Nov 2017 22:53:57 -0000 1.99 +++ rthread.c 6 Jul 2018 12:04:07 -0000 @@ -367,6 +367,9 @@ pthread_create(pthread_t *threadp, const thread->arg = arg; tib->tib_tid = -1; + if (attr != NULL && *attr == NULL) + return (EINVAL); + thread->attr = attr != NULL ? *(*attr) : _rthread_attr_default; if (thread->attr.sched_inherit == PTHREAD_INHERIT_SCHED) { pthread_t self = pthread_self();