From nobody Sun Nov 16 18:24:19 2025 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 4d8fR74JZFz6GsKq; Sun, 16 Nov 2025 18:24:19 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d8fR73qdvz42PS; Sun, 16 Nov 2025 18:24:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763317459; 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=mBO8r+r1RRbmLOrpyiUL7giAy+vuoYJlRsvV32Qhjg0=; b=GdCyGjqN06nUXNU5H2V3wa+B+9Zf8cVjL9pJhU+Y/r2SOnMz5TBIJUyNr9n0rj8cUXcct+ S+ET3CKHSLqucIeWM2RRWtorgK3T8X5Hi0mPkDWL8lHb6eOMZwy7Bev9PEvg0S5Oq/kqIO Nh+EFkQvqGM4qvBjdyDc4NykYPLcuVHEkD/eX1sBoJiJoc1SNwxnR/NtyHINyKlSSAAZyZ /iAzufBQACvBaxmaDNL3oFDYeCH+W39VvZHQ9u3iXVVz2BVrJeT9hEPFP5B1PUDjfoap/n vEIo4RIAy1wLh1bEd+diMrlVjyiq79c/4HPvJGJNDQVhvH4er1VV/5cwhPEaZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763317459; 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=mBO8r+r1RRbmLOrpyiUL7giAy+vuoYJlRsvV32Qhjg0=; b=d6lYjkFGGwDpesm072w1hC083c+t8zFTnY+QQ7RFtdPQHferOixnTAQD9HO9/+NnAUh31z uR6gGwu6m+lmWIwWyqweXu0yKqhMViD8NlPX5sT94ZUFRBTiXXjfoH8JS4v8lv5meaUKEO vCfkfHjTwLcQLrib3+HR+gFCYbnV6gvVaYP8i6fvvwY24eFyGmSHDz6EiTR377r0i0DkNO peBUNrROodnfC8azrhEaksJ5c1b9OUva2/bXMstzGrFPSq5JIHkk8SCGQ4lCR23+vV0v7Q cKfQ8LECMEb0h2mOR5z/e3ea2u/j9LUs88SPt51cLBA3JsEHCv7PMH0YXQmy5A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763317459; a=rsa-sha256; cv=none; b=ff1lm2WP8Q9AJlLqNOY/WZLnlf/fjzkUiTLQNwLRDyHKVUdDywOPTFyXdO0H6IRB3jOX5W tnqJhCpWtiJKMsDSNo+uLF3uaIFcp0vhIBQiqPrs0ZHmhLVnqXPYRiVh1U7S9TfsRVOkt/ EiBLAjHL90Tu4ZYhXXNT+cZVdLHN8haoY9sCUW1AO9R1x9rW8qqKY1vkDIH2DE+JiNaDii P6wYft9dhV9z+ryPeB5itzoyJpiVQtbg6dxHNvHSd7H9cwQsxYcZKTU5dV771gbAyhXqAd FRjwuPgUHw9YhVqRk9PENWvkaGFo6vEPT3T5FRnARjnGzyjwYsvr3/2iCOlNug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4d8fR73Bs1zqWW; Sun, 16 Nov 2025 18:24:19 +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 5AGIOJBj006335; Sun, 16 Nov 2025 18:24:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5AGIOJl4006332; Sun, 16 Nov 2025 18:24:19 GMT (envelope-from git) Date: Sun, 16 Nov 2025 18:24:19 GMT Message-Id: <202511161824.5AGIOJl4006332@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: ebc17879f088 - main - inotify: Work around the vput() bug directly 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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: ebc17879f0885ca87644980f6275b9759b311eb3 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ebc17879f0885ca87644980f6275b9759b311eb3 commit ebc17879f0885ca87644980f6275b9759b311eb3 Author: Mark Johnston AuthorDate: 2025-11-15 18:00:44 +0000 Commit: Mark Johnston CommitDate: 2025-11-16 18:20:15 +0000 inotify: Work around the vput() bug directly For 15.0, apply a minimal fix which at least ensures that inotify can't trigger the latent race described in commit 99cb3dca4773 ("vnode: Rework vput() to avoid holding the vnode lock after decrementing"). Reviewed by: olce, kib MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D53774 --- sys/kern/vfs_inotify.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_inotify.c b/sys/kern/vfs_inotify.c index e60d8426ee42..fd1ef39b13f7 100644 --- a/sys/kern/vfs_inotify.c +++ b/sys/kern/vfs_inotify.c @@ -381,7 +381,14 @@ inotify_unlink_watch_locked(struct inotify_softc *sc, struct inotify_watch *watc static void inotify_free_watch(struct inotify_watch *watch) { - vrele(watch->vp); + /* + * Formally, we don't need to lock the vnode here. However, if we + * don't, and vrele() releases the last reference, it's possible the + * vnode will be recycled while a different thread holds the vnode lock. + * Work around this bug by acquiring the lock here. + */ + (void)vn_lock(watch->vp, LK_EXCLUSIVE | LK_RETRY); + vput(watch->vp); free(watch, M_INOTIFY); }