From nobody Wed Nov 13 18:06:51 2024 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 4XpWSr0q28z5cPgJ; Wed, 13 Nov 2024 18:06:52 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XpWSq6jfCz41JF; Wed, 13 Nov 2024 18:06:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731521211; 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=FmmEstSn2l4eTHZ2bZDwpiCscYbST1L5s+iymwYPRpw=; b=Bs+wlvkwFPwso0wIsESHXVYet1Yc3FlHSIb2sa4toFZjgPvluVCFzGIHLgtcgACQd5Gcdc asAa/hmGQEYHoeG1CyigxaC2j6q71k+Fs/t4FDDl4VMO8DZIDO+htnUVYEnVSIpEVAx3mB 2mfajvk8daqvCwojn5Kmar1mDg2zKYUmP7dU8GW6Q3avy3AuUwk85DW0Yeu0CFXOb70jzH aK0MW4zsEEKLGf2ZJDmXfEzdLkvXiw7OOJEvsktDhAZuvpSyk6CUKXcIFC0gpQ+4HZ5YHu Ae1DkPz+PdHNene2KtWyxHX++NuRRUYP4FfJl00UJEEalLj19P9WghBGmZ7thw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731521211; 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=FmmEstSn2l4eTHZ2bZDwpiCscYbST1L5s+iymwYPRpw=; b=FF2/OViIGJGLdceP9NhCli5K5xV9p5zSZWEn+LJbmNX7AOJeHPTazrYzzv3dHslI+hw9dr RWX+xsY3dxmA5YadB8EmndWBgvaCRVs3VhJr827pSeNrxVLC/hPaa7rJaEuakTcACgHmsj we5jyB/bN5ApU2WqqYmuK6AyHU+5mm6D2NTXdsx/GnTt+GMETRVcDZa775OFl9AaXPONoL pQneuk14OIvmeJ7ME5xaIvEokrnUTbLrA2ccqgJapcBfbLdiv5/vivPuBO990GElecTHlT 0RPx9ap7hwGoMvBSUhqkXIPvt3xiJ9dtAOnthFq0h2pQW6HdXQHPuXBGcj1jpw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731521211; a=rsa-sha256; cv=none; b=v54dKunIyJX8pmxPeoSS5cihAIiSmQbjI5uA/NJUAgtX8w5fcR9A0kCfdATKbHayGILdJy vnt9RHFrJEsU2SiNsRA6AsIhlmBmcumcf5HdX80tdB0dwzifZBi/RyBeL0QHhNDCVXk0B9 J+Tqk4sKCnrTPFQuQltd1rb3VQ/oobN329vVXa5AQwyON0McGICVxb4T1HvMBShWe6SsZ2 HisQ3F64Jk7uB9FAi1Uimn7eESqe8DOK4sEDOebZXslAjpTI0CJ+l2AfvYxuOOp8XR7Xmw 4Qld5ZD+K2wgFSiEFHK1IYfDX97oGjGs1Iz8j1Q+uXK+CFPX1FuNLvEOyD2w5A== 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 4XpWSq62Sbz14nM; Wed, 13 Nov 2024 18:06:51 +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 4ADI6pCY085346; Wed, 13 Nov 2024 18:06:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ADI6pwe085343; Wed, 13 Nov 2024 18:06:51 GMT (envelope-from git) Date: Wed, 13 Nov 2024 18:06:51 GMT Message-Id: <202411131806.4ADI6pwe085343@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 19d23cb8acc9 - releng/14.2 - vm_object: do not assume that un_pager.devp.dev is cdev 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.2 X-Git-Reftype: branch X-Git-Commit: 19d23cb8acc934a9bb5ca46375da4cc5c4d2094c Auto-Submitted: auto-generated The branch releng/14.2 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=19d23cb8acc934a9bb5ca46375da4cc5c4d2094c commit 19d23cb8acc934a9bb5ca46375da4cc5c4d2094c Author: Konstantin Belousov AuthorDate: 2024-11-04 21:54:30 +0000 Commit: Konstantin Belousov CommitDate: 2024-11-13 18:06:36 +0000 vm_object: do not assume that un_pager.devp.dev is cdev PR: 282533 Approved by: re (cperciva) (cherry picked from commit 580340dbdaaf372867e9ed3dd257430982753e5e) (cherry picked from commit 92a9501b6be3d37a4eefcfbdda799b656ae146e8) --- sys/kern/kern_proc.c | 5 +++-- sys/vm/vm_mmap.c | 3 +++ sys/vm/vm_object.c | 3 ++- sys/vm/vm_object.h | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 18302bb8abae..b7fa7bfb60e9 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2718,8 +2718,9 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags) kve->kve_ref_count = obj->ref_count; kve->kve_shadow_count = obj->shadow_count; - if (obj->type == OBJT_DEVICE || - obj->type == OBJT_MGTDEVICE) { + if ((obj->type == OBJT_DEVICE || + obj->type == OBJT_MGTDEVICE) && + (obj->flags & OBJ_CDEVH) != 0) { cdev = obj->un_pager.devp.handle; if (cdev != NULL) { csw = dev_refthread(cdev, &ref); diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 6b0a70d523d5..21ec52b8124f 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -1435,6 +1435,9 @@ vm_mmap_cdev(struct thread *td, vm_size_t objsize, vm_prot_t prot, td->td_ucred); if (obj == NULL) return (EINVAL); + VM_OBJECT_WLOCK(obj); + vm_object_set_flag(obj, OBJ_CDEVH); + VM_OBJECT_WUNLOCK(obj); *objp = obj; *flagsp = flags; return (0); diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 5933b2c1d4bd..84e56b910809 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2610,7 +2610,8 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) sp = swap_pager_swapped_pages(obj); kvo->kvo_swapped = sp > UINT32_MAX ? UINT32_MAX : sp; } - if (obj->type == OBJT_DEVICE || obj->type == OBJT_MGTDEVICE) { + if ((obj->type == OBJT_DEVICE || obj->type == OBJT_MGTDEVICE) && + (obj->flags & OBJ_CDEVH) != 0) { cdev = obj->un_pager.devp.handle; if (cdev != NULL) { csw = dev_refthread(cdev, &ref); diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 16ee3544b658..bd71820bed3c 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -206,6 +206,7 @@ struct vm_object { #define OBJ_PAGERPRIV2 0x00008000 /* Pager private */ #define OBJ_SYSVSHM 0x00010000 /* SysV SHM */ #define OBJ_POSIXSHM 0x00020000 /* Posix SHM */ +#define OBJ_CDEVH 0x00040000 /* OBJT_DEVICE handle is cdev */ /* * Helpers to perform conversion between vm_object page indexes and offsets.