NetBSD-Bugs archive

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

Re: kern/43452 (sem_close not possible after sem_unlink)



> >Number:         43452
> >Category:       kern
> >Synopsis:       sem_close not possible after sem_unlink
> >Confidential:   no
> >Severity:       non-critical
> >Priority:       medium
> >Responsible:    kern-bug-people
> >State:          open
> >Class:          sw-bug
> >Submitter-Id:   net
> >Arrival-Date:   Thu Jun 10 22:15:00 +0000 2010
> >Originator:     Antti Kantee
> >Release:        
> >Organization:
> >Environment:
> >Description:
> A semaphore for which sem_unlink() is called is supposed to retain
> resources until sem_close() is called.  However, sem_close() returns
> EINVAL due to sem_unlink() removing evidence of a named semaphore.

Besides described problem, current semaphore has more issues such as:
ksem_free() destroying the semaphore before making it invisible;
ksem_unlink () not checking for permissions; excessive locking (when
dropping the reference, and heavy RW-lock use), etc.

Here is basically a rewritten POSIX semaphore - using file descriptor,
quite more simplified, fixing the bugs:

http://www.netbsd.org/~rmind/uipc_sem.diff
http://www.netbsd.org/~rmind/uipc_sem.c 

However, multiple sem_open(3) calls on the same path return different
references (file descriptors), which contradicts to POSIX, which has
unusual requirement here to return the same sem_t address.

-- 
Mindaugas


Home | Main Index | Thread Index | Old Index