summaryrefslogtreecommitdiffstats
path: root/sys/security/mac_mls
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2005-04-14 16:03:30 +0000
committercsjp <csjp@FreeBSD.org>2005-04-14 16:03:30 +0000
commite89e83d7fe58cc228e95e5dea896e841c5a94fc8 (patch)
treea937e6876873279cfd5117a2a8a0ee95fe63505b /sys/security/mac_mls
parent4b37bbd4869afe14bdd327fff059627a656722c0 (diff)
downloadFreeBSD-src-e89e83d7fe58cc228e95e5dea896e841c5a94fc8.zip
FreeBSD-src-e89e83d7fe58cc228e95e5dea896e841c5a94fc8.tar.gz
Move MAC check_vnode_mmap entry point out from being exclusive to
MAP_SHARED so that the entry point gets executed un-conditionally. This may be useful for security policies which want to perform access control checks around run-time linking. -add the mmap(2) flags argument to the check_vnode_mmap entry point so that we can make access control decisions based on the type of mapped object. -update any dependent API around this parameter addition such as function prototype modifications, entry point parameter additions and the inclusion of sys/mman.h header file. -Change the MLS, BIBA and LOMAC security policies so that subject domination routines are not executed unless the type of mapping is shared. This is done to maintain compatibility between the old vm_mmap_vnode(9) and these policies. Reviewed by: rwatson MFC after: 1 month
Diffstat (limited to 'sys/security/mac_mls')
-rw-r--r--sys/security/mac_mls/mac_mls.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/security/mac_mls/mac_mls.c b/sys/security/mac_mls/mac_mls.c
index b2f525a..fb0c2a5 100644
--- a/sys/security/mac_mls/mac_mls.c
+++ b/sys/security/mac_mls/mac_mls.c
@@ -46,6 +46,7 @@
#include <sys/extattr.h>
#include <sys/kernel.h>
#include <sys/mac.h>
+#include <sys/mman.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/proc.h>
@@ -2380,7 +2381,7 @@ mac_mls_check_vnode_lookup(struct ucred *cred, struct vnode *dvp,
static int
mac_mls_check_vnode_mmap(struct ucred *cred, struct vnode *vp,
- struct label *label, int prot)
+ struct label *label, int prot, int flags)
{
struct mac_mls *subj, *obj;
@@ -2398,7 +2399,7 @@ mac_mls_check_vnode_mmap(struct ucred *cred, struct vnode *vp,
if (!mac_mls_dominate_effective(subj, obj))
return (EACCES);
}
- if (prot & VM_PROT_WRITE) {
+ if (((prot & VM_PROT_WRITE) != 0) && ((flags & MAP_SHARED) != 0)) {
if (!mac_mls_dominate_effective(obj, subj))
return (EACCES);
}
OpenPOWER on IntegriCloud