https://bugs.kde.org/show_bug.cgi?id=475650

            Bug ID: 475650
           Summary: DRD does not work with C11 threads
    Classification: Developer tools
           Product: valgrind
           Version: unspecified
          Platform: Archlinux
                OS: Linux
            Status: REPORTED
          Severity: crash
          Priority: NOR
         Component: drd
          Assignee: bart.vanassche+...@gmail.com
          Reporter: weilercd...@gmail.com
  Target Milestone: ---

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.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to