From owner-svn-src-head@freebsd.org Sat Feb 17 17:23:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EEC5AF21D87; Sat, 17 Feb 2018 17:23:43 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A2E3B8A399; Sat, 17 Feb 2018 17:23:43 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DD2B1FB8A; Sat, 17 Feb 2018 17:23:43 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1HHNhwh048329; Sat, 17 Feb 2018 17:23:43 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1HHNhHV048328; Sat, 17 Feb 2018 17:23:43 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201802171723.w1HHNhHV048328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 17 Feb 2018 17:23:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329461 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Feb 2018 17:23:44 -0000 Author: mjg Date: Sat Feb 17 17:23:43 2018 New Revision: 329461 URL: https://svnweb.freebsd.org/changeset/base/329461 Log: Revert r329448. Turns out is is actually racy, reproducible with stress2/misc/truss.sh Requested by: kib Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Sat Feb 17 14:44:03 2018 (r329460) +++ head/sys/kern/kern_exit.c Sat Feb 17 17:23:43 2018 (r329461) @@ -1225,11 +1225,15 @@ loop_locked: nfound++; PROC_LOCK_ASSERT(p, MA_OWNED); + if ((options & (WTRAPPED | WUNTRACED)) != 0) + PROC_SLOCK(p); + if ((options & WTRAPPED) != 0 && (p->p_flag & P_TRACED) != 0 && (p->p_flag & (P_STOPPED_TRACE | P_STOPPED_SIG)) != 0 && p->p_suspcount == p->p_numthreads && (p->p_flag & P_WAITED) == 0) { + PROC_SUNLOCK(p); CTR4(KTR_PTRACE, "wait: returning trapped pid %d status %#x " "(xstat %d) xthread %d", @@ -1244,10 +1248,13 @@ loop_locked: (p->p_flag & P_STOPPED_SIG) != 0 && p->p_suspcount == p->p_numthreads && (p->p_flag & P_WAITED) == 0) { + PROC_SUNLOCK(p); report_alive_proc(td, p, siginfo, status, options, CLD_STOPPED); return (0); } + if ((options & (WTRAPPED | WUNTRACED)) != 0) + PROC_SUNLOCK(p); if ((options & WCONTINUED) != 0 && (p->p_flag & P_CONTINUED) != 0) { report_alive_proc(td, p, siginfo, status, options,