git: 13d866b314f8 - main - vm_object: Reset kvo_path on each iteration in vm_object_list_handler()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 10 Oct 2025 13:29:29 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=13d866b314f87df901c0a1cbbbc56d56ee0d7b7c

commit 13d866b314f87df901c0a1cbbbc56d56ee0d7b7c
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-10-10 13:26:29 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-10-10 13:26:29 +0000

    vm_object: Reset kvo_path on each iteration in vm_object_list_handler()
    
    Otherwise we print a bogus path for anonymous objects.
    
    Reviewed by:    kib
    MFC after:      1 week
    Sponsored by:   Modirum MDPay
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D52997
---
 sys/vm/vm_object.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 6d9ea8bf9d93..fe84523b7a8f 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -2522,15 +2522,13 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
 			continue;
 		}
 		mtx_unlock(&vm_object_list_mtx);
+
+		memset(kvo, 0, sizeof(*kvo));
 		kvo->kvo_size = ptoa(obj->size);
 		kvo->kvo_resident = obj->resident_page_count;
 		kvo->kvo_ref_count = obj->ref_count;
 		kvo->kvo_shadow_count = atomic_load_int(&obj->shadow_count);
 		kvo->kvo_memattr = obj->memattr;
-		kvo->kvo_active = 0;
-		kvo->kvo_inactive = 0;
-		kvo->kvo_laundry = 0;
-		kvo->kvo_flags = 0;
 		if (!swap_only) {
 			vm_page_iter_init(&pages, obj);
 			VM_RADIX_FOREACH(m, &pages) {
@@ -2552,9 +2550,6 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
 			}
 		}
 
-		kvo->kvo_vn_fileid = 0;
-		kvo->kvo_vn_fsid = 0;
-		kvo->kvo_vn_fsid_freebsd11 = 0;
 		freepath = NULL;
 		fullpath = "";
 		vp = NULL;