From nobody Mon Jun 9 23:53:17 2025 X-Original-To: dev-commits-src-all@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 4bGTJY3gBLz5yh9h; Mon, 09 Jun 2025 23:53:17 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bGTJY2Gzjz3K81; Mon, 09 Jun 2025 23:53:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749513197; 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=75h5LjOHwJM0sG+qwVl3W0ujCvV9qOQQUwSzoawItCk=; b=ytcsVzugAqq2kI1dO4MzFEwouZ7pr1G1Rh7nRONpPUbKQHBhKTJFA0RKnU/rYOoJR5+KVn RyNp5mjW+JWoxMXQ1L1CbSwFEk1O6nxBoT2hU4ceHluY7PScL5vz+sE8LxHEdjWKJ7O8Hr ewWQZXL3KXQFa933jugZUNUx4JMhleCBHJD7f2By11iw1BUx1nUaveZuOpoXqVC2uGtkGP T5nfP86CxPobZRKA9NIU4yDB7uQESgDd1bK8cRSypU3fq1QtJiu/Xt8pSciGgcow0EhUYv jBLOvhHMgfVg+3hXegPZpvW5ye9UT056pQAggOjUISFaBkkBIhhbXRQZijgfew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749513197; 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=75h5LjOHwJM0sG+qwVl3W0ujCvV9qOQQUwSzoawItCk=; b=cw15oe1cvg2D+nutUdbi0xdmli0A2ALz3dviHOIJjaNynzFsR/bID9K5S4IxFaNTmjKk5R PcFbpi9YdCIscpIR/spjh+PExJH0QrjiBZscKOAU5E1isvoJP2KCCX1MXtqSFqzkfJorbB Z1PShRocLh7EJnhIUjTlSzgVm1OGvxjaiaX/Wb4E1cH/mhRYxs16xnkgsDrDcEtcm8aGWP xfCkjEOdExa25uSETFzG+o5Z0snVVmTXlTwXQ/Qi0WJeJxX2ZDgZrjBzpjapNJ2NB+MiLN 1/1OVV6GOxoxi7tZIjqom0vwaCtMb6b+twNwpt9QXa9KDUJ2RZU1km3atYwyhA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1749513197; a=rsa-sha256; cv=none; b=pn4NlY9NtCkgypdylpmeCwh66LXGJxg1DD5gOobjsOVwHu0cp50ht5kSFDv+ZdU7lWxWUu D6Gyt5r/+FMVr5qZruj/qQlcrXjg8lhUUctEZjqcfxAHA5301eWKMVAlj4+04lHZGx62Z/ D8+7mqEDwbKiKMw5YPXlpvWoTTCGr9Vq5jFVO1mD/Id6q0sRzKWp2sQW+76Jrwp2VsVWhY pIPPLdlh36kO9k9CDlyXS5jON32bcLwF1+VcuN3T8ATH2j/1o2bsOSz7xb6xNmr7iYIv3P JodQlYQQqRF4qEk6B22jPTu7vsP3GK2n6UVaJs/ilBKRsKXU3JE3hLAnbeai2w== 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 4bGTJY1bk9z26t; Mon, 09 Jun 2025 23:53:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 559NrHQI006728; Mon, 9 Jun 2025 23:53:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 559NrHqr006725; Mon, 9 Jun 2025 23:53:17 GMT (envelope-from git) Date: Mon, 9 Jun 2025 23:53:17 GMT Message-Id: <202506092353.559NrHqr006725@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: 8dda34d0ef79 - main - exit1(): Ensure that SIGCHLD from reparented child is queued to reaper List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: 8dda34d0ef79d0d247b3487ae0499bdf12c9209e Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8dda34d0ef79d0d247b3487ae0499bdf12c9209e commit 8dda34d0ef79d0d247b3487ae0499bdf12c9209e Author: Konstantin Belousov AuthorDate: 2025-06-08 07:31:28 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-09 23:50:57 +0000 exit1(): Ensure that SIGCHLD from reparented child is queued to reaper We have a reaper R and child A with grandchild B. Now, suppose that B already have exited, and that A did not waited on B. When A is exiting, its child B is reparented to R, but its p_ksi was already queued for A. This means that SIGCHLD is not queued to R, it is only marked as pending in bitmap. If other SIGCHLD is queued, we would miss a delivery of the notification for B exiting. Additionally, R does not see siginfo for B. Do not even try to send SIGCHLD if the target is zombie. Only update the ksi state for possible consumption by the reaper. Tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50752 --- sys/kern/kern_sig.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 3df4e8f0fb25..c972d0620ab2 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -3732,7 +3732,14 @@ sigparent(struct proc *p, int reason, int status) if (KSI_ONQ(p->p_ksi)) return; } - pksignal(p->p_pptr, SIGCHLD, p->p_ksi); + + /* + * Do not consume p_ksi if parent is zombie, since signal is + * dropped immediately. Instead, keep it since it might be + * useful for reaper. + */ + if (p->p_pptr->p_state != PRS_ZOMBIE) + pksignal(p->p_pptr, SIGCHLD, p->p_ksi); } static void