summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_priv.c
diff options
context:
space:
mode:
authorjamie <jamie@FreeBSD.org>2013-07-05 21:31:16 +0000
committerjamie <jamie@FreeBSD.org>2013-07-05 21:31:16 +0000
commit33714247f6f8142b4840d7f4b94a28921bcf2076 (patch)
tree27053ab76be2f31865a9a3cba2472860fcc9f592 /sys/kern/kern_priv.c
parentbe7444451060bb6bbf361f251d66c2a5c689d37f (diff)
downloadFreeBSD-src-33714247f6f8142b4840d7f4b94a28921bcf2076.zip
FreeBSD-src-33714247f6f8142b4840d7f4b94a28921bcf2076.tar.gz
Add new privileges, PRIV_KMEM_READ and PRIV_KMEM_WRITE, used in opening
/dev/kmem and /dev/mem (in addition to traditional file permission checks). PRIV_KMEM_READ is different from other PRIV_* checks in that it's allowed by default. Reviewed by: kib, mckusick
Diffstat (limited to 'sys/kern/kern_priv.c')
-rw-r--r--sys/kern/kern_priv.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/kern/kern_priv.c b/sys/kern/kern_priv.c
index fcd5993..204e00b 100644
--- a/sys/kern/kern_priv.c
+++ b/sys/kern/kern_priv.c
@@ -142,6 +142,15 @@ priv_check_cred(struct ucred *cred, int priv, int flags)
}
/*
+ * Writes to kernel memory are a typical root-only operation,
+ * but non-root users are expected to be able to read it.
+ */
+ if (priv == PRIV_KMEM_READ) {
+ error = 0;
+ goto out;
+ }
+
+ /*
* Now check with MAC, if enabled, to see if a policy module grants
* privilege.
*/
OpenPOWER on IntegriCloud