From nobody Tue Sep 29 16:00:03 2026 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 4hvNDM3MnGz6tlHR for ; Tue, 29 Sep 2026 16:00:03 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hvNDM1y4pz4gtT for ; Tue, 29 Sep 2026 16:00:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790697603; 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=erq7wVibop5oqIAoAyw9yrqZlev3kCKZPTVwFxo5h10=; b=OoOI3AUeOdY81Podt4wxaitX/YFTTvAHPJzUj4R8QFIPpg+n3NLCdU4DGoLhgYCrQjB1Go l+uPo28S5nBRkq198RPJ1nQTsYcp1Fa9pLOMe7t1ykHEKQUfF0AuzU8/Uu7wwAa5K8awd4 mn63nR2tYtLClwI5+0yb9e+7R6cLVGqscMZkOh7kNZ5vNE3YBCHNxqXYwIxNbQEUV+DrTc Lu5XsQo9Qe2AJfWbO0hUCFJuUzSKIU60E1Xq7xxgVM23f2IpGeS6SpBD9fWvuUoNiJusld A/b3lcxTUaCf9/CgaPpgOezYtvNqyqd0dZLOb/YE7Q52+0QU/lYVqFUp7NVw+Q== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1790697603; b=YYzFfzIeRaRYrjwqITi6YW5LBxeziPZskXa9ouhI8LY+GixQrzhjWAHSpMJbtLOQ/qAvEo tC+HCJkQUZXzv7rY+9hUfQf2HWA9aeIfdzt6lgeBgLIewb6Z6OqJ9pPi4CBdTvpaK1NwMx y5PIcKfiAwnO5SCtrVy5FNfw1sai87zbjwNPVXndsp1kYit7CCvTV9ybAtVw8m3snWzRRB 4AViAjVhKDl2JIOet1AFyB2cmKcaFFBP4BH2Hu6vYPKg9aOMpO6CIdfhXjrA6sP+YN3ynN Tz1iAF/ylSieg8F20i8zs6+8vFVQBYrF2KE6JpNXBh+3C7ubuiVaRMjlM9pS2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790697603; 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=erq7wVibop5oqIAoAyw9yrqZlev3kCKZPTVwFxo5h10=; b=Fs1mi2Qs4SQHPfdy3mzdsXxwtu8yFoert4jjLBk9HvXeR2SqJqWWJxCk7EjjohOXyXj4hG TFXmg3xKt6zKBvzQmu63pyBz8h1eYx5fpBptwitTEA+OswKfs10jnEbslC0AfORsLkwTdv kWmJwXx2RJEQ7Wl5sjMZTmP1Haers7d2G2mdsTEx4JwFH8nbF7Div3WD68Fot/pvEi3Y1w 5Te8qM2QQIfje9b70UG5rqMtZOBkoukaBl7JQV3ZvQlg/0VwhW0KzktxL9EAGKaA4/t7S7 n+VEM4LTQQwul36GcVyjAx6AnTGZ9f+Fq6n/9WpOWI+HK9OUG1eIZA7c/JH9cw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hvNDM12r5z1JRZ for ; Tue, 29 Sep 2026 16:00:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30420 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 29 Sep 2026 16:00:03 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 78df5deaf5f1 - releng/15.1 - kqueue: Fix handling of marker knotes during fork 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/15.1 X-Git-Reftype: branch X-Git-Commit: 78df5deaf5f120221cf2965346bb5f23d1d1ab72 Auto-Submitted: auto-generated Date: Tue, 29 Sep 2026 16:00:03 +0000 Message-Id: <6abbe083.30420.64614c9b@gitrepo.freebsd.org> The branch releng/15.1 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=78df5deaf5f120221cf2965346bb5f23d1d1ab72 commit 78df5deaf5f120221cf2965346bb5f23d1d1ab72 Author: Mark Johnston AuthorDate: 2026-09-28 13:40:45 +0000 Commit: Mark Johnston CommitDate: 2026-09-29 01:01:48 +0000 kqueue: Fix handling of marker knotes during fork Commit d8bdcb08d0eb fixed a problem in kqueue_fork_copy_knote() where we did not skip over marker knotes when copying. However, that fix was not sufficient: we bump the influx counter and check for a marker after dropping the kqueue lock. So, if multiple threads in a process are forking concurrently, kqueue_fork_copy_list() may mark a marker as in-flux and drop the lock; if the marker owner then frees the marker, the first thread will decrement the in-flux counter of a freed knotes. This use-after-free can be exploited, at least prior to commit d8bdcb08d0eb, which makes exploitation more challenging. Approved by: so Security: FreeBSD-SA-26:65.kqueue Security: CVE-2026-58099 Reported by: Reo Shiseki Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59522 --- sys/kern/kern_event.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 706f0e6d658e..ec9036bd30de 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -3085,9 +3085,9 @@ kqueue_fork_copy_knote(struct kqueue *kq, struct kqueue *kq1, struct knote *kn, ("%s: knote %p not in flux", __func__, kn)); KASSERT((kn->kn_status & KN_DETACHED) == 0, ("%s: knote %p not detached", __func__, kn)); + KASSERT((kn->kn_status & KN_MARKER) == 0, + ("%s: knote %p not detached", __func__, kn)); - if ((kn->kn_status & KN_MARKER) != 0) - return; if ((kn->kn_status & KN_KQUEUE) != 0) { /* * We cannot hold references to a kqueue outside of the process @@ -3153,7 +3153,7 @@ kqueue_fork_copy_list(struct klist *knlist, struct knote *marker, kn = SLIST_FIRST(knlist); while (kn != NULL) { MPASS(kn->kn_kq == kq); - if ((kn->kn_status & KN_DETACHED) != 0 || + if ((kn->kn_status & (KN_DETACHED | KN_MARKER)) != 0 || (kn_in_flux(kn) && (kn->kn_status & KN_SCAN) == 0)) { kn = SLIST_NEXT(kn, kn_link); continue;