NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/52751: pthread_mutex_lock(3) does not return EINVAL on destroyed lock



>Number:         52751
>Category:       lib
>Synopsis:       pthread_mutex_lock(3) does not return EINVAL on destroyed lock
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 22 13:00:00 +0000 2017
>Originator:     Kamil Rytarowski
>Release:        NetBSD 8.99.7 amd64
>Organization:
TNF
>Environment:
NetBSD chieftec 8.99.7 NetBSD 8.99.7 (GENERIC) #8: Tue Nov 21 08:36:07 CET 2017  root@chieftec:/public/netbsd-root/sys/arch/amd64/compile/GENERIC amd64
>Description:
pthread_mutex_lock(3) after calling pthread_mutex_destroy(3) does not return EINVAL. It returns errno 0, which is fine.

Linux and FreeBSD return EINVAL and errno 0.
>How-To-Repeat:
$ gcc tt2.c -pthread                                                                                                         
$ ./a.out                                                                                                                    
ret=0 errno=0
$ cat tt2.c                                                                                                                  
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

int main(int argc, char *argv[]) { 
  int ret;

  pthread_mutex_t m;
  pthread_mutex_init(&m, 0);
  pthread_mutex_lock(&m);
  pthread_mutex_unlock(&m);
  pthread_mutex_destroy(&m);

  ret = pthread_mutex_lock(&m);

  printf("ret=%d errno=%d\n", ret, errno);

  return 0;
}

>Fix:
N/A



Home | Main Index | Thread Index | Old Index