From nobody Tue Sep 29 15:55:44 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 4hvN7P1hPKz6tl0J for ; Tue, 29 Sep 2026 15:55:45 +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 4hvN7P08z5z4TGw for ; Tue, 29 Sep 2026 15:55:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790697345; 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=ilZifjU77A4fXs1/z/Pd3GBOpbGtaygahJ5tLspl5Qc=; b=J21UvPJqPViUHjiuUUBdtf0hZiJUxMor6GbHQqS0yleZxDHGx9DmRo43kD65yUBQK8gU4+ 7CEa65O6Tk+1YjGOHNKF7NH6xfO4ycV4/G1bBC0Yo+PYqqvmPK3aZLd3i8wI9sCvZITVG/ fATjxrdnGB7LLBkcnilnD/kWkqXx1AEjmSvtg3c7qYK7qycOXo2kwOR6Hz1uF/etnKPwVV AEqNk6+1VY07K0AGlz8BhRzgYBe00YUhOTXhsqGj/SDdG+WZWJGlNItT4/W0J7gPqQyGSf EV1uik1KUY08z5/kg8le4d4lrh+sBcxcTSwlyH75zkTUguwRoACdCEwUFGAX5Q== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1790697345; b=GSLBsTKH6Wx0kG6hG1+KFAPkzoHcSdQ8dlIzbpR38I09GDfliOV3GaTXTYALNW1zxrZuj3 xauubB3Foj/yUdB/xJIY8zvdN0cAUkPApDGkSD5UBZXLrQXeeBpIc+p2IJ9HR7Mah76KYA X/aZWMGnPMcP/4aKSnctx//s0cP9fV3+tLSNfIGdcWmer78nE5rWQ/wiCx2JbEYDcTAhsn jq2MuzJaSxUfAUzrjwI9muoF7O/IdMzJBomhf2+Qfc9RxQniJSnvCFC28oDyIUwy4rhKTk n3x9CRedfWZsYt953whXYDJpUZHIDVIXM5P+I9XquZ166PkEnbtW2zO/V+FckQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790697345; 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=ilZifjU77A4fXs1/z/Pd3GBOpbGtaygahJ5tLspl5Qc=; b=t48ZvXXkJQkwwFgr6/gvQTGOAC6h171cfbHGSOz/H8Q76UQ1C02s6xCCGTKtLYHeTiMDqd 2X2w47oPdTslYk2EoPn1Fc2V8MpML627pwmJPLrNRKHeIddeEleJ0wJmrJ3+EMHtSmOHbW glFN76zuDPoGRaUcYWJX5ivL+zMdAt1zsoZFE8iSlcFtZ+8/5diezIajKFCKbIfvZtl1mc t7HgUklWPk/icDnvUSZrfn6WgYmTrTgjkoZrlD1TiD8kl2Qyblr1cceQRWvDPbo5WatxSU 5c7W9Ly2KpVt/s8xB/gQ/ba4LZ4zNDFQo/v9pevOfzeByD5BkmkWfLM09ZKFGg== 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 4hvN7N5ZFtz1KN8 for ; Tue, 29 Sep 2026 15:55:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2721c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 29 Sep 2026 15:55:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5804ea3da210 - main - kqueue: Fix a potential OOB access in kqueue_fork_copy_knote() 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/main X-Git-Reftype: branch X-Git-Commit: 5804ea3da21096f7c1707799e918b4eb592838be Auto-Submitted: auto-generated Date: Tue, 29 Sep 2026 15:55:44 +0000 Message-Id: <6abbdf80.2721c.166ebe35@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5804ea3da21096f7c1707799e918b4eb592838be commit 5804ea3da21096f7c1707799e918b4eb592838be Author: Mark Johnston AuthorDate: 2026-09-28 13:42:54 +0000 Commit: Mark Johnston CommitDate: 2026-09-29 15:54:16 +0000 kqueue: Fix a potential OOB access in kqueue_fork_copy_knote() Here, fdp points to the new fdtable, copied from that of the parent process. There is a window after the fdtable is copied, and before kqueue_fork_copy_knote() runs, where a different thread in the parent could have grown the parent's fdtable and registered a knote with ident larger than the size of the child's fdtable. This race can lead to an out-of-bounds read. Add a bounds check for this case; skip the knote if it is referencing a non-existent file. Approved by: so Security: FreeBSD-SA-26:65.kqueue Security: CVE-2026-58100 Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59916 --- sys/kern/kern_event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 9fa7f50dc625..92f7833db282 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -3108,7 +3108,8 @@ kqueue_fork_copy_knote(struct kqueue *kq, struct kqueue *kq1, struct knote *kn, } fop = kn->kn_fop; if (fop->f_copy == NULL || (fop->f_isfd && - fdp->fd_files->fdt_ofiles[kn->kn_kevent.ident].fde_file == NULL)) + ((unsigned int)fdp->fd_files->fdt_nfiles <= kn->kn_kevent.ident || + fdp->fd_files->fdt_ofiles[kn->kn_kevent.ident].fde_file == NULL))) return; error = kqueue_expand(kq1, fop, kn->kn_kevent.ident, M_WAITOK); if (error != 0)