NetBSD Problem Report #52634
From campbell@mumble.net Fri Oct 20 15:59:32 2017
Return-Path: <campbell@mumble.net>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 5A6A47A183
for <gnats-bugs@gnats.NetBSD.org>; Fri, 20 Oct 2017 15:59:32 +0000 (UTC)
Message-Id: <20171020160227.9022460A4B@jupiter.mumble.net>
Date: Fri, 20 Oct 2017 16:02:27 +0000 (UTC)
From: Taylor R Campbell <riastradh@NetBSD.org>
Reply-To: Taylor R Campbell <riastradh@NetBSD.org>
To: gnats-bugs@gnats.NetBSD.org
Subject: possible unhandled spurious wakeup in posix_spawn
X-Send-Pr-Version: 3.95
>Number: 52634
>Category: kern
>Synopsis: possible unhandled spurious wakeup in posix_spawn
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: martin
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Oct 20 16:00:00 +0000 2017
>Closed-Date: Sat Jun 27 17:25:29 +0000 2026
>Last-Modified: Sat Jun 27 17:25:29 +0000 2026
>Originator: Taylor R Campbell <riastradh@NetBSD.org>
>Release: NetBSD-current
>Organization:
The NetBSD Foundation
>Environment:
any
>Description:
do_posix_spawn calls cv_wait without looping on a test for a
condition, which may cause it to return before the child is
ready -- and potentially even to read and return an
uninitialized error -- in the case of a spurious wakeup:
https://nxr.netbsd.org/xref/src/sys/kern/kern_exec.c?r=1.448#2605
>How-To-Repeat:
Code inspection.
>Fix:
Yes, please!
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Fri, 20 Oct 2017 16:03:05 +0000
Responsible-Changed-Why:
take
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/52634 CVS commit: src/sys/kern
Date: Sat, 15 Mar 2025 12:11:09 +0000
Module Name: src
Committed By: riastradh
Date: Sat Mar 15 12:11:09 UTC 2025
Modified Files:
src/sys/kern: kern_exec.c
Log Message:
posix_spawn(2): Fix race between parent and child.
This was an embarrassing misuse of condition variables.
PR kern/59175: posix_spawn hang, hanging other process too
PR kern/52634: possible unhandled spurious wakeup in posix_spawn
(This only resolves one of the symptoms wiz had in PR 59175; there is
also another issue involved with p_vmspace and p_psstrp.)
To generate a diff of this commit:
cvs rdiff -u -r1.525 -r1.526 src/sys/kern/kern_exec.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Sat, 15 Mar 2025 13:50:12 +0000
State-Changed-Why:
fixed in HEAD, needs pullup-9 and pullup-10
(This is not just a matter of spurious wakeups; it is also broken for
early wakeups.)
State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Fri, 26 Jun 2026 03:46:12 +0000
State-Changed-Why:
pullup-9 #2015
pullup-10 #1283
fixed in HEAD before netbsd-11 branch
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/52634 CVS commit: [netbsd-10] src/sys/kern
Date: Sat, 27 Jun 2026 17:21:06 +0000
Module Name: src
Committed By: martin
Date: Sat Jun 27 17:21:06 UTC 2026
Modified Files:
src/sys/kern [netbsd-10]: kern_exec.c
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1283):
sys/kern/kern_exec.c: revision 1.526
posix_spawn(2): Fix race between parent and child.
This was an embarrassing misuse of condition variables.
PR kern/59175: posix_spawn hang, hanging other process too
PR kern/52634: possible unhandled spurious wakeup in posix_spawn
(This only resolves one of the symptoms wiz had in PR 59175; there is
also another issue involved with p_vmspace and p_psstrp.)
To generate a diff of this commit:
cvs rdiff -u -r1.518.4.3 -r1.518.4.4 src/sys/kern/kern_exec.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/52634 CVS commit: [netbsd-9] src/sys/kern
Date: Sat, 27 Jun 2026 17:22:27 +0000
Module Name: src
Committed By: martin
Date: Sat Jun 27 17:22:27 UTC 2026
Modified Files:
src/sys/kern [netbsd-9]: kern_exec.c
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #2015):
sys/kern/kern_exec.c: revision 1.526
posix_spawn(2): Fix race between parent and child.
This was an embarrassing misuse of condition variables.
PR kern/59175: posix_spawn hang, hanging other process too
PR kern/52634: possible unhandled spurious wakeup in posix_spawn
(This only resolves one of the symptoms wiz had in PR 59175; there is
also another issue involved with p_vmspace and p_psstrp.)
To generate a diff of this commit:
cvs rdiff -u -r1.478.2.3 -r1.478.2.4 src/sys/kern/kern_exec.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Sat, 27 Jun 2026 17:25:29 +0000
State-Changed-Why:
fixed in HEAD, pulled up to 11, 10, and 9
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.