diff options
author | Masao Uebayashi <uebayasi@cvs.openbsd.org> | 2014-12-05 04:12:49 +0000 |
---|---|---|
committer | Masao Uebayashi <uebayasi@cvs.openbsd.org> | 2014-12-05 04:12:49 +0000 |
commit | c8525d7f58e30cc7e582a014d2ed096379ccbe9e (patch) | |
tree | ec1d9e9fd25511db56d8684473978444d773b6fb /lib | |
parent | 70eb0676761b32588c52742bb357451ea0d0c95d (diff) |
Introduce a new sysctl to retrieve VM map entries
This adds a new sysctl KERN_PROC_VMMAP, which returns an array of VM map
entries of a specified process. This prevents debuggers from iterating
vm_map_entry RB tree via kvm(3).
The name KERN_PROC_VMMAP and struct kinfo_vmentry are chosen from the same
function in FreeBSD. struct kinfo_vmentry is revised to reduce size, because
OpenBSD does not keep track of filepaths. The semantic is also changed to
return max buffer size as a hint, and start iteration at the specified base
address.
Much valuable input from deraadt@, guenther@, tedu@
OK tedu@ deraadt@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/sysctl.3 | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3 index 62d8e7c698a..eb6a2acedcb 100644 --- a/lib/libc/gen/sysctl.3 +++ b/lib/libc/gen/sysctl.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sysctl.3,v 1.243 2014/11/19 18:04:54 tedu Exp $ +.\" $OpenBSD: sysctl.3,v 1.244 2014/12/05 04:12:48 uebayasi Exp $ .\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: November 19 2014 $ +.Dd $Mdocdate: December 5 2014 $ .Dt SYSCTL 3 .Os .Sh NAME @@ -443,6 +443,7 @@ information. .It Dv KERN_PROC_ARGS Ta "node" Ta "not applicable" .It Dv KERN_PROC_CWD Ta "string" Ta "not applicable" .It Dv KERN_PROC_NOBROADKILL Ta "string" Ta "not applicable" +.It Dv KERN_PROC_VMMAP Ta "struct kinfo_vmentry" Ta "no" .It Dv KERN_PROF Ta "node" Ta "not applicable" .It Dv KERN_RAWPARTITION Ta "integer" Ta "no" .It Dv KERN_RND Ta "struct rndstats" Ta "no" @@ -739,6 +740,14 @@ A NUL-terminated string is returned. .It Dv KERN_PROC_NOBROADKILL When set, a process will no longer be signaled when sending broadcast signals. The third level name is the target process ID. +.It Dv KERN_PROC_VMMAP +Return the entire process VM map entries. +An array of +.Li struct kinfo_vmentry +structures is returned, +whose size depends on the current number of VM map entries of the selected process. +Iteration is possible by setting the base address in the first element of +.Li struct kinfo_vmentry . .It Dv KERN_PROF Return profiling information about the kernel. If the kernel is not compiled for profiling, |