|
From: <sv...@va...> - 2007-11-01 17:13:54
|
Author: sewardj
Date: 2007-11-01 17:13:52 +0000 (Thu, 01 Nov 2007)
New Revision: 7075
Log:
Regression test and suppression support for glibc-2.3 systems.
Added:
branches/THRCHECK/thrcheck/tests/tc09_bad_unlock.stderr.exp-glibc23-amd64
branches/THRCHECK/thrcheck/tests/tc20_verifywrap.stderr.exp-glibc23-amd64
Modified:
branches/THRCHECK/glibc-2.X-thrcheck.supp
branches/THRCHECK/thrcheck/tests/Makefile.am
branches/THRCHECK/thrcheck/tests/tc20_verifywrap.c
Modified: branches/THRCHECK/glibc-2.X-thrcheck.supp
===================================================================
--- branches/THRCHECK/glibc-2.X-thrcheck.supp 2007-11-01 14:04:43 UTC (rev 7074)
+++ branches/THRCHECK/glibc-2.X-thrcheck.supp 2007-11-01 17:13:52 UTC (rev 7075)
@@ -226,6 +226,34 @@
fun:__lll_lock_wait
}
+######--------- glibc-2.3 specific ---------######
+{
+ thrcheck-glibc23-01
+ Thrcheck:Race
+ obj:/lib*/ld-2.3.*so
+ obj:/lib*/ld-2.3.*so
+ obj:/lib*/ld-2.3.*so
+}
+{
+ thrcheck-glibc23-04
+ Thrcheck:Race
+ obj:/lib*/libc-2.3.*so
+ obj:/lib*/libc-2.3.*so
+}
+
+{
+ thrcheck-glibc23-10
+ Thrcheck:Race
+ obj:/lib*/libpthread-2.3.*so
+ fun:pthread_*
+}
+{
+ thrcheck-glibc23-11
+ Thrcheck:Race
+ fun:mythread_wrapper
+ obj:/lib*/libpthread-2.3.*so
+}
+
######------ qt4 specific (GNU mangling) ------######
{
thrcheck-qt4-QMutex::lock()-twice
Modified: branches/THRCHECK/thrcheck/tests/Makefile.am
===================================================================
--- branches/THRCHECK/thrcheck/tests/Makefile.am 2007-11-01 14:04:43 UTC (rev 7074)
+++ branches/THRCHECK/thrcheck/tests/Makefile.am 2007-11-01 17:13:52 UTC (rev 7075)
@@ -41,6 +41,7 @@
tc08_hbl2.vgtest tc08_hbl2.stdout.exp \
tc08_hbl2.stderr.exp-glibc25-amd64 \
tc09_bad_unlock.vgtest tc09_bad_unlock.stdout.exp \
+ tc09_bad_unlock.stderr.exp-glibc23-amd64 \
tc09_bad_unlock.stderr.exp-glibc25-amd64 \
tc09_bad_unlock.stderr.exp-glibc25-x86 \
tc10_rec_lock.vgtest tc10_rec_lock.stdout.exp \
@@ -69,6 +70,7 @@
tc19_shadowmem.stderr.exp-glibc25-amd64 \
tc19_shadowmem.stderr.exp-glibc25-x86 \
tc20_verifywrap.vgtest tc20_verifywrap.stdout.exp \
+ tc20_verifywrap.stderr.exp-glibc23-amd64 \
tc20_verifywrap.stderr.exp-glibc25-amd64 \
tc20_verifywrap.stderr.exp-glibc25-x86 \
tc21_pthonce.vgtest tc21_pthonce.stdout.exp \
Added: branches/THRCHECK/thrcheck/tests/tc09_bad_unlock.stderr.exp-glibc23-amd64
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc09_bad_unlock.stderr.exp-glibc23-amd64 (rev 0)
+++ branches/THRCHECK/thrcheck/tests/tc09_bad_unlock.stderr.exp-glibc23-amd64 2007-11-01 17:13:52 UTC (rev 7075)
@@ -0,0 +1,86 @@
+
+Thread #1 is the program's root thread
+
+Thread #1 unlocked a not-locked lock at 0x........
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:27)
+ by 0x........: main (tc09_bad_unlock.c:49)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:23)
+ by 0x........: main (tc09_bad_unlock.c:49)
+
+Thread #2 was created
+ at 0x........: clone (in /...libc...)
+ by 0x........: ...
+ by 0x........: pthread_create@GLIBC_ (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:35)
+ by 0x........: main (tc09_bad_unlock.c:49)
+
+Thread #2 unlocked lock at 0x........ currently held by thread #1
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
+ by 0x........: child_fn (tc09_bad_unlock.c:11)
+ by 0x........: mythread_wrapper (tc_intercepts.c:...)
+ by 0x........: ...
+ by 0x........: ...
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:31)
+ by 0x........: main (tc09_bad_unlock.c:49)
+
+Thread #1 unlocked an invalid lock at 0x........
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:41)
+ by 0x........: main (tc09_bad_unlock.c:49)
+
+Thread #1 deallocated location 0x........ containing a locked lock
+ at 0x........: nearly_main (tc09_bad_unlock.c:45)
+ by 0x........: main (tc09_bad_unlock.c:49)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:31)
+ by 0x........: main (tc09_bad_unlock.c:49)
+
+Thread #1 unlocked a not-locked lock at 0x........
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:27)
+ by 0x........: main (tc09_bad_unlock.c:50)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:23)
+ by 0x........: main (tc09_bad_unlock.c:50)
+
+Thread #3 was created
+ at 0x........: clone (in /...libc...)
+ by 0x........: ...
+ by 0x........: pthread_create@GLIBC_ (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:35)
+ by 0x........: main (tc09_bad_unlock.c:50)
+
+Thread #3 unlocked lock at 0x........ currently held by thread #1
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
+ by 0x........: child_fn (tc09_bad_unlock.c:11)
+ by 0x........: mythread_wrapper (tc_intercepts.c:...)
+ by 0x........: ...
+ by 0x........: ...
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:31)
+ by 0x........: main (tc09_bad_unlock.c:50)
+
+Thread #1 unlocked an invalid lock at 0x........
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:41)
+ by 0x........: main (tc09_bad_unlock.c:50)
+
+Thread #1 deallocated location 0x........ containing a locked lock
+ at 0x........: nearly_main (tc09_bad_unlock.c:45)
+ by 0x........: main (tc09_bad_unlock.c:50)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:31)
+ by 0x........: main (tc09_bad_unlock.c:50)
+
+ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0)
Modified: branches/THRCHECK/thrcheck/tests/tc20_verifywrap.c
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc20_verifywrap.c 2007-11-01 14:04:43 UTC (rev 7074)
+++ branches/THRCHECK/thrcheck/tests/tc20_verifywrap.c 2007-11-01 17:13:52 UTC (rev 7075)
@@ -20,6 +20,10 @@
#include <pthread.h>
#include <semaphore.h>
+#if !defined(__GLIBC_PREREQ)
+# error "This program needs __GLIBC_PREREQ (in /usr/include/features.h)"
+#endif
+
short unprotected = 0;
void* lazy_child ( void* v ) {
@@ -45,6 +49,14 @@
pthread_rwlock_t rwl3;
sem_t s1;
+# if __GLIBC_PREREQ(2,4)
+ fprintf(stderr,
+ "\n\n------ This is output for >= glibc 2.4 ------\n");
+# else
+ fprintf(stderr,
+ "\n\n------ This is output for < glibc 2.4 ------\n");
+# endif
+
/* --------- pthread_create/join --------- */
fprintf(stderr,
@@ -77,16 +89,27 @@
/* make pthread_mutex_init fail */
memset( &mxa, 0xFF, sizeof(mxa) );
- r= pthread_mutex_init( &mx, &mxa ); assert(r);
+ r= pthread_mutex_init( &mx, &mxa );
+# if __GLIBC_PREREQ(2,4)
+ assert(r); /* glibc >= 2.4: the call should fail */
+# else
+ assert(!r); /* glibc < 2.4: oh well, glibc didn't bounce this */
+# endif
/* make pthread_mutex_destroy fail */
r= pthread_mutex_init( &mx2, NULL ); assert(!r);
r= pthread_mutex_lock( &mx2 ); assert(!r);
r= pthread_mutex_destroy( &mx2 ); assert(r);
- /* make pthread_mutex_lock fail */
+ /* make pthread_mutex_lock fail (skipped on < glibc 2.4 because it
+ doesn't fail, hence hangs the test) */
+# if __GLIBC_PREREQ(2,4)
memset( &mx3, 0xFF, sizeof(mx3) );
r= pthread_mutex_lock( &mx3 ); assert(r);
+# else
+ fprintf(stderr, "\nmake pthread_mutex_lock fail: "
+ "skipped on glibc < 2.4\n\n");
+# endif
/* make pthread_mutex_trylock fail */
memset( &mx3, 0xFF, sizeof(mx3) );
@@ -99,7 +122,12 @@
/* make pthread_mutex_unlock fail */
memset( &mx3, 0xFF, sizeof(mx3) );
- r= pthread_mutex_unlock( &mx3 ); assert(r);
+ r= pthread_mutex_unlock( &mx3 );
+# if __GLIBC_PREREQ(2,4)
+ assert(r);
+# else
+ assert(!r);
+# endif
/* --------- pthread_cond_wait et al --------- */
Added: branches/THRCHECK/thrcheck/tests/tc20_verifywrap.stderr.exp-glibc23-amd64
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc20_verifywrap.stderr.exp-glibc23-amd64 (rev 0)
+++ branches/THRCHECK/thrcheck/tests/tc20_verifywrap.stderr.exp-glibc23-amd64 2007-11-01 17:13:52 UTC (rev 7075)
@@ -0,0 +1,139 @@
+
+
+
+------ This is output for < glibc 2.4 ------
+
+---------------- pthread_create/join ----------------
+
+Thread #1 is the program's root thread
+
+Thread #2 was created
+ at 0x........: clone (in /...libc...)
+ by 0x........: ...
+ by 0x........: pthread_create@GLIBC_ (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:76)
+
+Possible data race during write of size 2 at 0x........
+ at 0x........: main (tc20_verifywrap.c:78)
+ Old state: owned exclusively by thread #2
+ New state: shared-modified by threads #1, #2
+ Reason: this thread, #1, holds no locks at all
+
+Thread #1's call to pthread_join failed
+ with error code 35 (EDEADLK: Resource deadlock would occur)
+ at 0x........: pthread_join (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:83)
+
+---------------- pthread_mutex_lock et al ----------------
+
+
+Thread #1: pthread_mutex_destroy of a locked mutex
+ at 0x........: pthread_mutex_destroy (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:102)
+
+Thread #1's call to pthread_mutex_destroy failed
+ with error code 16 (EBUSY: Device or resource busy)
+ at 0x........: pthread_mutex_destroy (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:102)
+
+make pthread_mutex_lock fail: skipped on glibc < 2.4
+
+
+Thread #1 unlocked an invalid lock at 0x........
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:125)
+
+---------------- pthread_cond_wait et al ----------------
+
+
+Thread #1 unlocked a not-locked lock at 0x........
+ at 0x........: pthread_cond_wait@* (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:147)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:145)
+
+Thread #1's call to pthread_cond_wait failed
+ with error code 1 (EPERM: Operation not permitted)
+ at 0x........: pthread_cond_wait@* (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:147)
+
+FIXME: can't figure out how to verify wrap of pthread_cond_signal
+
+
+FIXME: can't figure out how to verify wrap of pthread_broadcast_signal
+
+
+Thread #1's call to pthread_cond_timedwait failed
+ with error code 22 (EINVAL: Invalid argument)
+ at 0x........: pthread_cond_timedwait@* (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:165)
+
+---------------- pthread_rwlock_* ----------------
+
+
+Thread #1 unlocked a not-locked lock at 0x........
+ at 0x........: pthread_rwlock_unlock (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:179)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_rwlock_init (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:178)
+(1) no error on next line
+(2) no error on next line
+(3) ERROR on next line
+
+Thread #1 unlocked a not-locked lock at 0x........
+ at 0x........: pthread_rwlock_unlock (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:196)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_rwlock_init (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:186)
+(4) no error on next line
+(5) no error on next line
+(6) no error on next line
+(7) no error on next line
+(8) ERROR on next line
+
+Thread #1 unlocked a not-locked lock at 0x........
+ at 0x........: pthread_rwlock_unlock (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:212)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_rwlock_init (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:186)
+
+---------------- sem_* ----------------
+
+
+Thread #1's call to sem_init failed
+ with error code 22 (EINVAL: Invalid argument)
+ at 0x........: sem_init@* (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:228)
+
+FIXME: can't figure out how to verify wrap of sem_destroy
+
+
+Thread #1: Bug in libpthread: sem_wait succeeded on semaphore without prior sem_post
+ at 0x........: sem_wait_WRK (tc_intercepts.c:...)
+ by 0x........: sem_wait (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:242)
+
+FIXME: can't figure out how to verify wrap of sem_post
+
+
+------------ dealloc of mem holding locks ------------
+
+
+Thread #1 deallocated location 0x........ containing a locked lock
+ at 0x........: main (tc20_verifywrap.c:263)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_rwlock_init (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:216)
+
+Thread #1 deallocated location 0x........ containing a locked lock
+ at 0x........: main (tc20_verifywrap.c:263)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
+ by 0x........: main (tc20_verifywrap.c:145)
+
+ERROR SUMMARY: 15 errors from 15 contexts (suppressed: 0 from 0)
|