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

            Bug ID: 357871
           Summary: pthread_spin_destroy not properly wrapped
           Product: valgrind
           Version: unspecified
          Platform: Fedora RPMs
                OS: Linux
            Status: UNCONFIRMED
          Severity: crash
          Priority: NOR
         Component: helgrind
          Assignee: jsew...@acm.org
          Reporter: dilla...@redhat.com

There is a typo in helgrind's wrapper function for pthread_spin_destroy.  It is
written as "pthreadZuspinZusdestroy" (note the extra 's' before destroy) in
hg_intercepts.c.  

I was encountering very strange errors with helgrind complaining that
pthread_rwlock_XYZ calls are using pthread_mutex arguments.  I've tracked it
down to the fact that evh__hg_PTHREAD_SPIN_DESTROY_PRE is never invoked to
clean up the lock mapping.  Eventually, a pthread_rwlock would be allocated to
the same memory address and the error would occur.


Reproducible: Always

Steps to Reproduce:
1. pthread_spin_init at memory address X
2. pthread_spin_destroy at memory address X
3. pthread_rwlock_init at same memory address X
4. pthread_rwlock_destroy at memory address X

Actual Results:  
Error message:
"pthread_rwlock_{rd,rw}lock with a pthread_mutex_t* argument" if
pthread_rwlock_*lock invoked

"pthread_rwlock_destroy with invalid argument" and assert failure if
pthread_rwlock_destroy invoked

Expected Results:  
Life is good -- no error, no crash

--- valgrind-3.11.0/helgrind/hg_intercepts.old        2016-01-11
16:57:00.912000000 -0500
+++ valgrind-3.11.0/helgrind/hg_intercepts.c        2016-01-11
16:57:19.519000000 -0500
@@ -1854,13 +1854,13 @@
    return ret;
 }
 #if defined(VGO_linux)
-   PTH_FUNC(int, pthreadZuspinZusdestroy, // pthread_spin_destroy
+   PTH_FUNC(int, pthreadZuspinZudestroy, // pthread_spin_destroy
             pthread_spinlock_t *lock) {
       return pthread_spin_destroy_WRK(lock);
    }
 #elif defined(VGO_darwin)
 #elif defined(VGO_solaris)
-   PTH_FUNC(int, pthreadZuspinZusdestroy, // pthread_spin_destroy
+   PTH_FUNC(int, pthreadZuspinZudestroy, // pthread_spin_destroy
             pthread_spinlock_t *lock) {
       return pthread_spin_destroy_WRK(lock);
    }

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

Reply via email to