diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2004-02-23 03:21:24 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2004-02-23 03:21:24 +0000 |
commit | fc843e0db0726d89bf5422a69cfb1a659cf6c3e8 (patch) | |
tree | 7c44b086a79fca1cacb3f63fb61c38b371d10b23 /usr.sbin/procmap/procmap.c | |
parent | c405e11efb4948635a9f2969977ce6b2855e6628 (diff) |
no peeking at kernel or other processes for normal users. ok deraadt@
Diffstat (limited to 'usr.sbin/procmap/procmap.c')
-rw-r--r-- | usr.sbin/procmap/procmap.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.sbin/procmap/procmap.c b/usr.sbin/procmap/procmap.c index 5cd2507e562..a3ca9649340 100644 --- a/usr.sbin/procmap/procmap.c +++ b/usr.sbin/procmap/procmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procmap.c,v 1.9 2004/02/19 08:22:34 tedu Exp $ */ +/* $OpenBSD: procmap.c,v 1.10 2004/02/23 03:21:23 tedu Exp $ */ /* $NetBSD: pmap.c,v 1.1 2002/09/01 20:32:44 atatat Exp $ */ /* @@ -342,6 +342,20 @@ process_map(kvm_t *kd, pid_t pid, struct kinfo_proc *proc) size_t total; u_long addr, next; char *thing; + uid_t uid; + + if ((uid = getuid())) { + if (pid == 0) { + warnx("kernel map is restricted"); + return; + } + if (uid != proc->kp_eproc.e_ucred.cr_uid) { + warnx("other process's maps are restricted"); + return; + } + } + + vmspace = &kbit[0]; vm_map = &kbit[1]; |