summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2003-03-05 23:50:15 +0000
committerrwatson <rwatson@FreeBSD.org>2003-03-05 23:50:15 +0000
commit9ecf925a7d952716f0fd6c5a64b072a3caee80af (patch)
treea528f54ce13be77b6cce282371e23bf45a6d45ad /sys/vm
parent3158a8710ade4d09a7a6763dceb8f57a09acfa9d (diff)
downloadFreeBSD-src-9ecf925a7d952716f0fd6c5a64b072a3caee80af.zip
FreeBSD-src-9ecf925a7d952716f0fd6c5a64b072a3caee80af.tar.gz
Provide a mac_check_system_swapoff() entry point, which permits MAC
modules to authorize disabling of swap against a particular vnode. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_swap.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c
index f968838..057a85d 100644
--- a/sys/vm/vm_swap.c
+++ b/sys/vm/vm_swap.c
@@ -433,6 +433,14 @@ swapoff(td, uap)
error = EINVAL;
goto done;
found:
+#ifdef MAC
+ (void) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ error = mac_check_system_swapoff(td->td_ucred, vp);
+ (void) VOP_UNLOCK(vp, 0, td);
+ if (error != 0)
+ goto done;
+#endif
+
nblks = sp->sw_nblks;
/*
OpenPOWER on IntegriCloud