From nobody Tue Nov 17 17:01:41 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 4jTWGs5XjLz71QDM for ; Tue, 17 Nov 2026 17:01:41 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jTWGs2RkTz3PPw for ; Tue, 17 Nov 2026 17:01:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794934901; 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=01DAr0cXVp9lb5AbmBIQwzIDMRwNgzV5N/mDOuIegpc=; b=KmiyBrkbD5nFiCM9jjp7629NTyHjSmV7aUGUGUTuCnYU47JY+deZOa8OMlD2F95YLh7zva PlMAxsv+scXTZN9ZR4kunXkEYS4fjAnDMUOG4F9ZoMGdYJVcx9w+XjLHIg4D0kUX8laWE9 JxOio2OXVmDRQU4Y98Fm7VZtLj6yEX/s7PWNS4NyOx20rGImcAwKAoqEe3Njpi5YDcjrbh QGSXmDyVr4XNKMH1k4sNe0R5JAJFcn1afRNAMVxnWWdusLpMpTqunQtqb5ucFBP7BhK5+D URK2garezEwXllEqVPUCG5Qb+dFU2oPDlJVLdz221Xz3hi1ApspzwqxwDK3igA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794934901; b=lBN2iasmOWPQoHOBWeni9TRcX3qt/hIuZSqKEP3258AAP8ASALVdQsOZRpwedycPTWLt1j ldrkZ5SAXIWaAozo1MFr/a+q/Di780dymqqnSoZseXWDduLUnEe5eg5804xvi3ew2Flq8d ZEqAcaO/yj+GRzefzL7ehSDWl4a5/7onQVgpaShaNOSRgjCaELGa8mwAdIt5LpHuV4GJB/ oHP/ehfSFx816GiIcG06nQWlcXi4BU8w+OnhCdGIj7hdddPQuDUA4V89j0jLyblVBrgGX5 afblAN1IUXe5PVckZqCiK/56XPVO4TYGns/8h6E7gQ6hcwx7e6GFFgAxnRdGfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794934901; 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=01DAr0cXVp9lb5AbmBIQwzIDMRwNgzV5N/mDOuIegpc=; b=FjTExcpZPv9SGeyl7s3Rc45Dq3Z/ITVAHWyXUWKL5XpEjA5o4h+20WTuhNxUtSvHR73qZZ 7chudvEvanP10V0UU1Vie6yhqQu87rfr5/x6aNPv/FmT8w3QoTZHZvgdqYcWD0Emt/wwKZ WLYScXZpzqoJ5SoRDV4ZOLJMakKjXqjOtILj2/UHO0GWfxJ72JnC4/i9oKdD+jx/LJFNis sSd3yOcx+7QZ2shnX///4PHw+yvqkytjM9OPmJPUalCwslo0TdJ0+Nr+YTOMVxDulbFHEV FH3IxvWb9C8SVhDj10zqQQVWX+A2qY1Ul2G+KrzkTn3oKVvIOC/DRkuiK2tOXg== 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 4jTWGs22V4zrLG for ; Tue, 17 Nov 2026 17:01:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e0b5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Nov 2026 17:01:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 18017d0865d8 - main - inotify: Make the oneshot watch lookup stricter List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository 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: 18017d0865d871aa1aa5fda0055b1c8c0661edd3 Auto-Submitted: auto-generated Date: Tue, 17 Nov 2026 17:01:41 +0000 Message-Id: <6afc8875.1e0b5.711ada82@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=18017d0865d871aa1aa5fda0055b1c8c0661edd3 commit 18017d0865d871aa1aa5fda0055b1c8c0661edd3 Author: Mark Johnston AuthorDate: 2026-10-28 19:31:13 +0000 Commit: Mark Johnston CommitDate: 2026-11-17 16:57:00 +0000 inotify: Make the oneshot watch lookup stricter inotify_log_one() needs to handle one-shot watches, which are removed from the inotify descriptor after the first event. To handle races with a close of the inotify descriptor, which frees all watches, it re-looks up the watch in the descriptor's watch tree, which is keyed by the watch descriptor number. inotify_log_one() assumed that presence of the watch descriptor in the tree meant that the watch on which it is operating is also present in the tree. However, watch descriptors are 32 bits wide and malicious userspace can trigger descriptor reuse such that this assumption is false, and inotify_log_one() ends up freeing the wrong watch, resulting in an exploitable use-after-free. Approved by: so Security: FreeBSD-SA-26:80.vfs Security: CVE-2026-101316 Fixes: f1f230439fa4 ("vfs: Initial revision of inotify") Reported by: OpenAI Security Research Team Sponsored by: The FreeBSD Foundation --- sys/kern/vfs_inotify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_inotify.c b/sys/kern/vfs_inotify.c index 13555c2692f9..79ede53a8893 100644 --- a/sys/kern/vfs_inotify.c +++ b/sys/kern/vfs_inotify.c @@ -660,7 +660,7 @@ inotify_log_one(struct inotify_watch *watch, const char *name, size_t namelen, * responsible for freeing it. */ key.wd = watch->wd; - if (RB_FIND(inotify_watch_tree, &sc->watches, &key) != NULL) { + if (RB_FIND(inotify_watch_tree, &sc->watches, &key) == watch) { RB_REMOVE(inotify_watch_tree, &sc->watches, watch); inotify_unlink_watch_locked(sc, watch);