When I add the abort and use your C++ test case, I see the abort:

bergner@ampere:~$ cat pthread_mutex_lock.c 
#include <stdlib.h>
#include <pthread.h>

#define PTHREAD_MUTEX_NO_ELISION_NP 512
extern int __pthread_mutex_lock (pthread_mutex_t *);

int
pthread_mutex_lock (pthread_mutex_t *mutex)
{
  abort();
  mutex->__data.__kind |= PTHREAD_MUTEX_NO_ELISION_NP;
  return __pthread_mutex_lock (mutex);
}
bergner@ampere:~$ gcc -fPIC -c pthread_mutex_lock.c 
bergner@ampere:~$ gcc -shared -Wl,-soname,libbar.so.1 -o libbar.so.1 
pthread_mutex_lock.o 
bergner@ampere:~$ cat foo.cpp 
#include <mutex>

int main(int argc, char* argv[]) {
    std::mutex m;
    std::lock_guard<std::mutex> guard(m);
    return EXIT_SUCCESS;
}
bergner@ampere:~$ g++ -std=c++11 -pthread foo.cpp
bergner@ampere:~$ ./a.out 
bergner@ampere:~$ LD_PRELOAD=./libbar.so.1 ./a.out 
Aborted

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1640518

Title:
  MongoDB Memory corruption

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1640518/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to