Currently, calling pthread_mutex_lock on a destroyed (or uninitialized or completely invalid) mutex will silently continue, without any TSan reports. This is because the function will return EINVAL in these cases. However, it's extremely uncommon to correctly handle failure return values from pthread_mutex_lock. In fact, I don't remember ever seeing code that even checks the return value from pthread_mutex_lock.
This patch adds a new TSan report type, ReportTypeMutexInvalidAccess, which is triggered when pthread_mutex_lock or pthread_mutex_unlock returns EINVAL (this means the mutex is invalid, uninitialized or already destroyed).