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:          needs-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 20 16:00:00 +0000 2017
>Closed-Date:    
>Last-Modified:  Sat Mar 15 13:50:12 +0000 2025
>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.)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.