This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bug with PI mutex and static linking


Dear all,

with glibc 2.22, the following test fails on x86_64 when statically linking with EPERM when doing the pthread_mutex_unlock(). It looks like  mutex->__data.__owner is not properly initialized, as it is 0 when trying to unlock.

This worked fine with glibc 2.18 and still works with glibc 2.22 when dynamically linking.

Is this a known regression, maybe even with a patch being available already?

Thanks for any help,

Chris 

// compiled with gcc -static -pthread test.c
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <assert.h>

pthread_mutex_t mymutex;

int main(int argc, char *argv[])
{
    pthread_mutexattr_t attr;
    assert(!pthread_mutexattr_init(&attr));
    assert(!pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT));
    
    assert(!pthread_mutex_init(&mymutex, &attr));

    assert(!pthread_mutex_lock(&mymutex));
    printf("locked b\n");
    assert(!pthread_mutex_unlock(&mymutex));

    pthread_mutex_destroy(&mymutex);

   return EXIT_SUCCESS;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]