From nobody Sat Aug 20 17:34:59 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M95Nh2SL9z4ZpmD; Sat, 20 Aug 2022 17:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M95Nh1JJFz3Xg7; Sat, 20 Aug 2022 17:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661016900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iXSULAEzUbnfWlp0/xgRRmjQdwL+CKOen4GsXBj4UjQ=; b=uZWJRl6LFWP4Db1nTjC/BCnV0UaXYwUqrd2G5LxBIxz6PHdLCG9Bj0nrwumFVMo44wBZHd TvlLa76tyiiEVbcSI69amPd9J9pwKXzjjHP/sCHtYSRupcqQ/cCb4LEd9LFYB3OGwv78Z6 ABL6lljdodNEILwlbXeCw2cf8+PRGZuTinfS4b9Fjxr2aiku/rezAwV6PNWYHnfkgUFJvr HnFMMJt1H6NZNFaOLvUdgAF0lznay2Wpr5E0oaO8Y5rZRKeLFGEa4y3QonpZ3Sp+OKDcnq Z0cwuy76YF/66ASPWefKcMHJqg5f1KIqAvbMVGX+wEiGHX/Hg7G+mt7aX+myOQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M95Nh0Q5ZzgWR; Sat, 20 Aug 2022 17:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27KHYxIH093505; Sat, 20 Aug 2022 17:34:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27KHYxi4093504; Sat, 20 Aug 2022 17:34:59 GMT (envelope-from git) Date: Sat, 20 Aug 2022 17:34:59 GMT Message-Id: <202208201734.27KHYxi4093504@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 5e9bba94bd7f - main - fork_norfproc(): unlock p1 before retrying List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e9bba94bd7f6b61d6c9fcef239e963e55c1a87a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661016900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iXSULAEzUbnfWlp0/xgRRmjQdwL+CKOen4GsXBj4UjQ=; b=KxzVu6gdMvvYmrZ0rHtI9hbfvqpSXLw95/GMmnM/+B9lNgQDkGhyUgKb1bu/Rrq6T8H+vo K2f3PVOiulBDKQGiPBPF/+u/DrXoKnUPWQx9YR4MSQgb4lioFRDcKlG42Tw6iaTiuIonKE o5vfPYZStg9J7UOldb3AcADunggCyBHekPtLMqH4gVyznLWjZqV+UJdGEIuz/o1FxhuINQ qF+8wphGSYtMgCIZZA26cYOPzeejskQkqhFJn5wtLrBkP+MOJEUsx2bPHQ8iAI5tYbdGet mXaTQg5/4r7eumw33i7ZCU6JOb6Stfi7/NRQCuW8mhpT0lRz7bmE0lovrjlj5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661016900; a=rsa-sha256; cv=none; b=WJdzsQnvG7xvgO9OdWN8AhN9ODez6ZgvFFdTFgUE2cXJ3qYJvLwlXNqKDExft++ZovBSyW grSQjYNVGmbH+Ahmcn3gyX597jS/jg4qtWwwiP3CKKsRAVSIWIqCGb4ptKmcg//cc0lIt9 EKMBTjBpi7RcVg2dWFvP9tHWIGYQOvnXuEZi7vuzLHfWTLzAAnluJ9YbIMMTZrmpa2SN/o X/rkFpssm0r3EiKD6Xg0EW0F46F6x54Bqp+C5OS+/zZ8/zOt0D6lIMeHcqYgu31VVEZCi7 9Fm23MgMD9cJuWv9IaUM4g53Kln48Izs0RE4lnAjrG1ffW8Qj8nsMfREH6ILeQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5e9bba94bd7f6b61d6c9fcef239e963e55c1a87a commit 5e9bba94bd7f6b61d6c9fcef239e963e55c1a87a Author: Konstantin Belousov AuthorDate: 2022-08-10 17:03:31 +0000 Commit: Konstantin Belousov CommitDate: 2022-08-20 17:33:18 +0000 fork_norfproc(): unlock p1 before retrying Reported and reviewed by: markj Tested by: pho Syzkaller: 647212368c3f32c6f13f Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36207 --- sys/kern/kern_fork.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 434c5a6290fe..c71a0422b1e2 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -323,13 +323,11 @@ again: if ((p1->p_flag & (P_HADTHREADS | P_SYSTEM)) == P_HADTHREADS && ((flags & (RFCFDG | RFFDG)) != 0 || (flags & RFMEM) == 0)) { PROC_LOCK(p1); - while (p1->p_singlethr > 0) { + if (p1->p_singlethr > 0) { error = msleep(&p1->p_singlethr, &p1->p_mtx, - PWAIT | PCATCH, "rfork1t", 0); - if (error != 0) { - PROC_UNLOCK(p1); + PWAIT | PCATCH | PDROP, "rfork1t", 0); + if (error != 0) return (ERESTART); - } goto again; } if (thread_single(p1, SINGLE_BOUNDARY)) {