aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_mac.c
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2002-08-12 02:00:21 +0000
committerRobert Watson <rwatson@FreeBSD.org>2002-08-12 02:00:21 +0000
commit7ba28492c591e95840a0fe2bbe14a0bd9194813f (patch)
tree419a40a2f2650869dcd9a616bc847975e055d20b /sys/kern/kern_mac.c
parent62c0c26325de4f6af3bb3b68a34206dc367ed9f9 (diff)
downloadsrc-7ba28492c591e95840a0fe2bbe14a0bd9194813f.tar.gz
src-7ba28492c591e95840a0fe2bbe14a0bd9194813f.zip
Declare a module service "kernel_mac_support" when MAC support is
enabled and the kernel provides the MAC registration and entry point service. Declare a dependency on that module service for any MAC module registered using mac_policy.h. For now, hard code the version as 1, but once we've come up with a versioning policy, we'll move to a #define of some sort. In the mean time, this will prevent loading a MAC module when 'options MAC' isn't present, which (due to a bug in the kernel linker) can result if the MAC module is preloaded via loader.conf. This particular evil recommended by: peter Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI LAbs
Notes
Notes: svn path=/head/; revision=101712
Diffstat (limited to 'sys/kern/kern_mac.c')
-rw-r--r--sys/kern/kern_mac.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/kern_mac.c b/sys/kern/kern_mac.c
index 6544f01ae5d0..547647caa7bf 100644
--- a/sys/kern/kern_mac.c
+++ b/sys/kern/kern_mac.c
@@ -54,6 +54,7 @@
#include <sys/mutex.h>
#include <sys/sx.h>
#include <sys/mac.h>
+#include <sys/module.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
@@ -87,6 +88,13 @@
#ifdef MAC
+/*
+ * Declare that the kernel provides MAC support, version 1. This permits
+ * modules to refuse to be loaded if the necessary support isn't present,
+ * even if it's pre-boot.
+ */
+MODULE_VERSION(kernel_mac_support, 1);
+
SYSCTL_DECL(_security);
SYSCTL_NODE(_security, OID_AUTO, mac, CTLFLAG_RW, 0,