git: 71a66883b58f - main - kinfo_{vmobject,vmentry}: move copy of pathes into the vnode handling scope
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 08 Oct 2024 12:39:22 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=71a66883b58f796baf2bf79a43a91c16a71673b3
commit 71a66883b58f796baf2bf79a43a91c16a71673b3
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-10-07 07:36:51 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-10-08 12:37:47 +0000
kinfo_{vmobject,vmentry}: move copy of pathes into the vnode handling scope
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D46970
---
sys/kern/kern_proc.c | 7 +++----
sys/vm/vm_object.c | 5 ++---
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 422873ee14c2..7dc58b1e9bc9 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -2740,6 +2740,9 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags)
kve->kve_status = KF_ATTR_VALID;
}
vput(vp);
+ strlcpy(kve->kve_path, fullpath, sizeof(
+ kve->kve_path));
+ free(freepath, M_TEMP);
}
} else {
kve->kve_type = guard ? KVME_TYPE_GUARD :
@@ -2748,10 +2751,6 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags)
kve->kve_shadow_count = 0;
}
- strlcpy(kve->kve_path, fullpath, sizeof(kve->kve_path));
- if (freepath != NULL)
- free(freepath, M_TEMP);
-
/* Pack record size down */
if ((flags & KERN_VMMAP_PACK_KINFO) != 0)
kve->kve_structsize =
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 85fc27d169d6..6b9f89790ccd 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -2611,11 +2611,10 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
/* truncate */
}
vput(vp);
+ strlcpy(kvo->kvo_path, fullpath, sizeof(kvo->kvo_path));
+ free(freepath, M_TEMP);
}
- strlcpy(kvo->kvo_path, fullpath, sizeof(kvo->kvo_path));
- free(freepath, M_TEMP);
-
/* Pack record size down */
kvo->kvo_structsize = offsetof(struct kinfo_vmobject, kvo_path)
+ strlen(kvo->kvo_path) + 1;