SUMMARY DRD does not appear to support C11 threads. STEPS TO REPRODUCE Just create a thread in C with `thrd_create` OBSERVED RESULT ==2451066== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==2451066== Access not within mapped region at address 0x7 ==2451066== at 0x4934634: pthread_attr_getdetachstate (pthread_attr_getdetachstate.c:29) ==2451066== by 0x484ED7D: pthread_create_intercept (drd_pthread_intercepts.c:609) ==2451066== by 0x484ED7D: pthread_create@* (drd_pthread_intercepts.c:640) ==2451066== by 0x493F689: thrd_create@@GLIBC_2.34 (thrd_create.c:28) EXPECTED RESULT Should not crash ADDITIONAL INFORMATION I did some digging and it appears glibcs ntpl implements thrd_create by calling __pthread_create with an attr of ATTR_C11_THREAD which is just a macro for ((void*)(uintptr_t)-1). Since this is not a null pointer, the check inside DRD's pthread_create_intercept succeeds then calls pthread_attr_getdetachstate with ((void*)(uintptr_t)-1) as the address of a valid attr struct.
For reference https://en.cppreference.com/w/c/thread/thrd_create
Does commit 6cea271f436d help?
The code fix looks OK, but I think that the configure test and regtest should use C11 rather than C++.
It's OK now on FreeBSD and I've also checked with musl and Illumos.
The following two additional commits have been pushed: * 45590cee742b ("drd/tests/thrd_create: Convert from C++ to C") * a9d065c48d35 ("configure.ac: Convert the thrd_create() test from C++ to C")