Package: libc0.1 Version: 2.13-33 Severity: wishlist Tags: patch User: debian-...@lists.debian.org Usertags: kfreebsd
The implementation of _pthread_unlock() doesn't react gracefully when it is asked to unlock a non-claimed resource. Thus, lock->__status can never be 0. Unfortunately when __status == 0 is passed, it will segfault in a very confusing way. Please use an assert() to give a more meaningful failure message. -- System Information: Debian Release: wheezy/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: kfreebsd-i386 (i686) Kernel: kFreeBSD 8.1-1-amd64 Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages libc0.1 depends on: ii libc-bin 2.13-33 ii libgcc1 1:4.7.0-13 Versions of packages libc0.1 recommends: ii libc0.1-i686 2.13-33 Versions of packages libc0.1 suggests: ii debconf [debconf-2.0] 1.5.43 pn glibc-doc <none> ii locales 2.13-33 ii locales-all [locales] 2.13-33 -- debconf information excluded
--- a/linuxthreads/spinlock.c +++ b/linuxthreads/spinlock.c @@ -19,6 +19,7 @@ #include <time.h> #include <stdlib.h> #include <limits.h> +#include <assert.h> #include "pthread.h" #include "internals.h" #include "spinlock.h" @@ -172,6 +173,9 @@ int maxprio; #endif + /* spinlock must be taken in order to unlock it */ + assert (lock->__status != 0); + #if defined TEST_FOR_COMPARE_AND_SWAP if (!__pthread_has_cas) #endif