diff options
author | kib <kib@FreeBSD.org> | 2008-12-12 12:12:36 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2008-12-12 12:12:36 +0000 |
commit | e7474699031b041ffcf3a7c7165b2f7af248c413 (patch) | |
tree | c4771bfc265745292755e059aa4af2e925f6f38c /sys/compat/linprocfs | |
parent | 2ef4ea7ee81ea8c88c6424914105f12ff9b04a48 (diff) | |
download | FreeBSD-src-e7474699031b041ffcf3a7c7165b2f7af248c413.zip FreeBSD-src-e7474699031b041ffcf3a7c7165b2f7af248c413.tar.gz |
Reference the vmspace of the process being inspected by procfs, linprocfs
and sysctl kern_proc_vmmap handlers.
Reported and tested by: pho
Reviewed by: rwatson, des
MFC after: 1 week
Diffstat (limited to 'sys/compat/linprocfs')
-rw-r--r-- | sys/compat/linprocfs/linprocfs.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 1023608..09c22e3 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include <net/vnet.h> #include <vm/vm.h> +#include <vm/vm_extern.h> #include <vm/pmap.h> #include <vm/vm_map.h> #include <vm/vm_param.h> @@ -874,7 +875,8 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) static int linprocfs_doprocmaps(PFS_FILL_ARGS) { - vm_map_t map = &p->p_vmspace->vm_map; + struct vmspace *vm; + vm_map_t map; vm_map_entry_t entry, tmp_entry; vm_object_t obj, tobj, lobj; vm_offset_t e_start, e_end; @@ -899,6 +901,10 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) return (EOPNOTSUPP); error = 0; + vm = vmspace_acquire_ref(p); + if (vm == NULL) + return (ESRCH); + map = &vm->vm_map; vm_map_lock_read(map); for (entry = map->header.next; entry != &map->header; entry = entry->next) { @@ -985,6 +991,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) } } vm_map_unlock_read(map); + vmspace_free(vm); return (error); } |