summaryrefslogtreecommitdiff
path: root/usr.sbin/procmap/procmap.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2004-02-23 03:21:24 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2004-02-23 03:21:24 +0000
commitfc843e0db0726d89bf5422a69cfb1a659cf6c3e8 (patch)
tree7c44b086a79fca1cacb3f63fb61c38b371d10b23 /usr.sbin/procmap/procmap.c
parentc405e11efb4948635a9f2969977ce6b2855e6628 (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.c16
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];