From nobody Wed Nov 18 19:24:59 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 4jVBPm0YdLz71664 for ; Wed, 18 Nov 2026 19:25:00 +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 4jVBPl38Snz3FCH for ; Wed, 18 Nov 2026 19:24:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795029899; 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=dMU6c31F7r+Pp9ouTQ402amIEilvZgnY3cIZ9lWHuX4=; b=r3L7CM0hp9eIMlAow195x8VM/X9SFQhK+qky4rkSSv9/otw0BU4zdOQOI83u4XBkQlY++6 Ed/WOACAlr0rd2h62ExLmYt3gGtKORrE46s2kb2IQPBe2ueT2ouxH2QWXHU+lvlXtgarRY 5kmMDCMsJFp+ceTSSOBgqZIGqA3GveiWx43JXDAlddRU1cbbTfa3bnkk6gGOlx9nuqApFa EcrJ4dbwfEIK255KuieD/k7qoweHj79Hd06l+2OdrZo21gZb5besoMD+3amjkymLSdn2e3 d3vCFVnmUHG7kPXERsdv98smgT6+gktDF1ZOW5MHHaUM46XEcBdJaGjIwk2qXQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795029899; b=ZngTag0WFqnjWMNm24wl+jbn5fZhpjbzQvm4gWwemxJLV6UUmK/BoRJ46r+sxiJiNaz12A wZKqajB1UbAthGsyYZyx1mQ1KGh3GHBggiMq5KQdK2LTsu/aS3givkk8tY9irLa0p1iLQp h5mCZIlcA3x/kliPMUtiFkAo0Hb+00xtFJI0LEpJT7a/g+yhy/o0dajV7BncjF4dEE7HqQ 4WIHerCuET+1wV11dhN+b/Bld0t5Q/EhmByyvsvd23v7s3m0/O4+mmqw2/cWzjaBj1RRCv m3NN891VEr42lado7kDM0Xzf1v0Ptji8uuaFAXPaSLIqTkLHvb5MdqxzQYzZYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795029899; 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=dMU6c31F7r+Pp9ouTQ402amIEilvZgnY3cIZ9lWHuX4=; b=JcezxTB62gpLqT+FGsw1rOWrPlEAZNv58ZYppKspHOaebTo4cj1sH6C95LUOM7aa/EIFZW SnIvsxnRLwwp8AbtqZwa8YOpTjraScoF3kz3gVmws9rOkbSe60K5VbKo3p25oENwyeTE2H 5s1vfHdjxr5QYUAkv1UnbnSnA0shGVSB9aolwuGav1jFPl0J2/YxWGn4xKQfH7tpSPcz0T CbFoy92MygxfB2HvjnEZGXAClOUYOFnmgP1QDRptML0CxdoSinLmzU5cya0//mZ60TWdri BMJXWjwP4fk5FGri9BF9QnnL1e7Eivtwk6e2EX+6Q3uSlWB8zyN+l/bx61wqlg== 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 4jVBPl1hD0zQwc for ; Wed, 18 Nov 2026 19:24:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1671f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 18 Nov 2026 19:24:59 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4e6e4fa8be99 - main - vm_object: Fix synchronization with teardown in the object list loop 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: 4e6e4fa8be9940e711b791073eee5bcfa77ec5d4 Auto-Submitted: auto-generated Date: Wed, 18 Nov 2026 19:24:59 +0000 Message-Id: <6afdfb8b.1671f.5008085b@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4e6e4fa8be9940e711b791073eee5bcfa77ec5d4 commit 4e6e4fa8be9940e711b791073eee5bcfa77ec5d4 Author: Mark Johnston AuthorDate: 2026-11-18 16:36:09 +0000 Commit: Mark Johnston CommitDate: 2026-11-18 19:24:35 +0000 vm_object: Fix synchronization with teardown in the object list loop Checking for OBJT_DEAD is racy since pagers update the object type without the object lock held. Check for the flag as well, as that is set beforehand. Otherwise pager dealloc can race with, e.g., cdev_pager_get_path(). Try to minimize accesses of the object after dropping the object lock in vm_object_list_handler(). --- sys/vm/vm_object.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 1e6e25d26a54..b6f5e4983fd4 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2523,7 +2523,7 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) vm_object_t obj; vm_page_t m; u_long sp; - int count, error; + int count, error, flags; key_t key; unsigned short seq; bool want_path; @@ -2556,12 +2556,13 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) */ mtx_lock(&vm_object_list_mtx); TAILQ_FOREACH(obj, &vm_object_list, object_list) { - if (obj->type == OBJT_DEAD || + if (obj->type == OBJT_DEAD || (obj->flags & OBJ_DEAD) != 0 || (swap_only && (obj->flags & (OBJ_ANON | OBJ_SWAP)) == 0)) continue; VM_OBJECT_RLOCK(obj); - if (obj->type == OBJT_DEAD || - (swap_only && (obj->flags & (OBJ_ANON | OBJ_SWAP)) == 0)) { + flags = obj->flags; + if (obj->type == OBJT_DEAD || (flags & OBJ_DEAD) != 0 || + (swap_only && (flags & (OBJ_ANON | OBJ_SWAP)) == 0)) { VM_OBJECT_RUNLOCK(obj); continue; } @@ -2604,7 +2605,7 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) NULL); if (vp != NULL) { vref(vp); - } else if ((obj->flags & OBJ_ANON) != 0) { + } else if ((flags & OBJ_ANON) != 0) { MPASS(kvo->kvo_type == KVME_TYPE_SWAP); kvo->kvo_me = (uintptr_t)obj; /* tmpfs objs are reported as vnodes */ @@ -2617,13 +2618,18 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) sizeof(kvo->kvo_path)); } VM_OBJECT_RUNLOCK(obj); - if ((obj->flags & OBJ_SYSVSHM) != 0) { + + /* + * Note, it is safe to invoke shmobjinfo() and shm_get_path() + * concurrent with teardown of the object. + */ + if ((flags & OBJ_SYSVSHM) != 0) { kvo->kvo_flags |= KVMO_FLAG_SYSVSHM; shmobjinfo(obj, &key, &seq); kvo->kvo_vn_fileid = key; kvo->kvo_vn_fsid_freebsd11 = seq; } - if ((obj->flags & OBJ_POSIXSHM) != 0) { + if ((flags & OBJ_POSIXSHM) != 0) { kvo->kvo_flags |= KVMO_FLAG_POSIXSHM; shm_get_path(obj, kvo->kvo_path, sizeof(kvo->kvo_path));