NetBSD-Bugs archive

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

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



The following reply was made to PR lib/52751; it has been noted by GNATS.

From: christos%zoulas.com@localhost (Christos Zoulas)
To: gnats-bugs%NetBSD.org@localhost, lib-bug-people%netbsd.org@localhost, 
	gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Cc: 
Subject: Re: lib/52751: pthread_mutex_lock(3) does not return EINVAL on destroyed lock
Date: Wed, 22 Nov 2017 09:17:36 -0500

 On Nov 22,  1:00pm, n54%gmx.com@localhost (n54%gmx.com@localhost) wrote:
 -- Subject: lib/52751: pthread_mutex_lock(3) does not return EINVAL on destro
 
 | >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);
 
 What happens when you set PTHREAD_DIAGASSERT appropriately in the environment?
 
 christos
 


Home | Main Index | Thread Index | Old Index