NetBSD Problem Report #43452
From www@NetBSD.org Thu Jun 10 22:13:07 2010
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 28FC763B93E
for <gnats-bugs@gnats.NetBSD.org>; Thu, 10 Jun 2010 22:13:07 +0000 (UTC)
Message-Id: <20100610221306.ED37763B92A@www.NetBSD.org>
Date: Thu, 10 Jun 2010 22:13:06 +0000 (UTC)
From: pooka@iki.fi
Reply-To: pooka@iki.fi
To: gnats-bugs@NetBSD.org
Subject: sem_close not possible after sem_unlink
X-Send-Pr-Version: www-1.0
>Number: 43452
>Category: kern
>Synopsis: sem_close not possible after sem_unlink
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: rmind
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jun 10 22:15:00 +0000 2010
>Closed-Date: Mon Apr 11 22:36:20 +0000 2011
>Last-Modified: Fri Mar 09 14:30:02 +0000 2012
>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.
>How-To-Repeat:
run tests/lib/semaphore/pthread/t_sem_pth tc unlink:
unlink: Failed: close unlinked semaphore: Invalid argument
>Fix:
>Release-Note:
>Audit-Trail:
From: Antti Kantee <pooka@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/43452 CVS commit: src/tests/lib/semaphore
Date: Thu, 10 Jun 2010 22:20:38 +0000
Module Name: src
Committed By: pooka
Date: Thu Jun 10 22:20:38 UTC 2010
Modified Files:
src/tests/lib/semaphore: sem.c
Log Message:
quote PR kern/43452 in descr
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/semaphore/sem.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Responsible-Changed-From-To: kern-bug-people->rmind
Responsible-Changed-By: rmind@NetBSD.org
Responsible-Changed-When: Sun, 03 Apr 2011 06:40:13 +0000
Responsible-Changed-Why:
Mine!
State-Changed-From-To: open->feedback
State-Changed-By: rmind@NetBSD.org
State-Changed-When: Tue, 05 Apr 2011 11:34:09 +0000
State-Changed-Why:
Code is there, but still deciding whether it is wworth to address the
POSIX spec. requirement.
From: Mindaugas Rasiukevicius <rmind@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org, netbsd-bugs@netbsd.org,
gnats-admin@netbsd.org, pooka@iki.fi
Subject: Re: kern/43452 (sem_close not possible after sem_unlink)
Date: Tue, 5 Apr 2011 12:31:08 +0100
> >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
From: "Mindaugas Rasiukevicius" <rmind@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/43452 CVS commit: src/sys
Date: Mon, 11 Apr 2011 22:31:43 +0000
Module Name: src
Committed By: rmind
Date: Mon Apr 11 22:31:43 UTC 2011
Modified Files:
src/sys/kern: uipc_sem.c
src/sys/sys: file.h
Log Message:
Highly rewrite POSIX semaphore. Use file descriptor subsystem, greatly
simplify reference counting, and fix various bugs which existed before,
e.g. some incorrect locking or mq_unlink() not checking for permissions.
Also, fixes PR/43452.
To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/kern/uipc_sem.c
cvs rdiff -u -r1.71 -r1.72 src/sys/sys/file.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: feedback->closed
State-Changed-By: rmind@NetBSD.org
State-Changed-When: Mon, 11 Apr 2011 22:36:20 +0000
State-Changed-Why:
Fixed.
From: "Joerg Sonnenberger" <joerg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/43452 CVS commit: src/tests/lib/semaphore
Date: Fri, 9 Mar 2012 14:25:35 +0000
Module Name: src
Committed By: joerg
Date: Fri Mar 9 14:25:34 UTC 2012
Modified Files:
src/tests/lib/semaphore: sem.c
Log Message:
PR 43452 no longer applies.
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/semaphore/sem.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.