Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146766701
D54833.id171897.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D54833.id171897.diff
View Options
diff --git a/sys/security/mac/mac_policy.h b/sys/security/mac/mac_policy.h
--- a/sys/security/mac/mac_policy.h
+++ b/sys/security/mac/mac_policy.h
@@ -436,6 +436,8 @@
struct prison *pr, struct label *prlabel);
typedef void (*mpo_prison_created_t)(struct ucred *cred,
struct prison *pr, struct label *prlabel);
+typedef void (*mpo_prison_cleanup_t)(struct ucred *cred,
+ struct prison *pr);
typedef void (*mpo_prison_attached_t)(struct ucred *cred,
struct prison *pr, struct label *prlabel, struct proc *p,
struct label *proclabel);
@@ -909,6 +911,7 @@
mpo_prison_check_set_t mpo_prison_check_set;
mpo_prison_check_remove_t mpo_prison_check_remove;
mpo_prison_created_t mpo_prison_created;
+ mpo_prison_cleanup_t mpo_prison_cleanup;
mpo_prison_attached_t mpo_prison_attached;
mpo_priv_check_t mpo_priv_check;
diff --git a/sys/security/mac/mac_prison.c b/sys/security/mac/mac_prison.c
--- a/sys/security/mac/mac_prison.c
+++ b/sys/security/mac/mac_prison.c
@@ -94,6 +94,9 @@
mac_prison_destroy(struct prison *pr)
{
mtx_assert(&pr->pr_mtx, MA_OWNED);
+
+ /* Symmetry with prison_created */
+ MAC_POLICY_PERFORM_NOSLEEP(prison_cleanup, curthread->td_ucred, pr);
mac_prison_label_free(pr->pr_label);
pr->pr_label = NULL;
}
diff --git a/sys/security/mac_stub/mac_stub.c b/sys/security/mac_stub/mac_stub.c
--- a/sys/security/mac_stub/mac_stub.c
+++ b/sys/security/mac_stub/mac_stub.c
@@ -914,6 +914,12 @@
}
+static void
+stub_prison_cleanup(struct ucred *cred, struct prison *pr)
+{
+
+}
+
static void
stub_prison_attached(struct ucred *cred, struct prison *pr,
struct label *prlabel, struct proc *p, struct label *proclabel)
@@ -1923,6 +1929,7 @@
.mpo_prison_check_set = stub_prison_check_set,
.mpo_prison_check_remove = stub_prison_check_remove,
.mpo_prison_created = stub_prison_created,
+ .mpo_prison_cleanup = stub_prison_cleanup,
.mpo_prison_attached = stub_prison_attached,
.mpo_priv_check = stub_priv_check,
diff --git a/sys/security/mac_test/mac_test.c b/sys/security/mac_test/mac_test.c
--- a/sys/security/mac_test/mac_test.c
+++ b/sys/security/mac_test/mac_test.c
@@ -1737,6 +1737,14 @@
COUNTER_INC(prison_created);
}
+COUNTER_DECL(prison_cleanup);
+static void
+test_prison_cleanup(struct ucred *cred, struct prison *pr)
+{
+
+ COUNTER_INC(prison_cleanup);
+}
+
COUNTER_DECL(prison_attached);
static void
test_prison_attached(struct ucred *cred, struct prison *pr,
@@ -3378,6 +3386,7 @@
.mpo_prison_check_set = test_prison_check_set,
.mpo_prison_check_remove = test_prison_check_remove,
.mpo_prison_created = test_prison_created,
+ .mpo_prison_cleanup = test_prison_cleanup,
.mpo_prison_attached = test_prison_attached,
.mpo_proc_check_debug = test_proc_check_debug,
diff --git a/sys/sys/param.h b/sys/sys/param.h
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -74,7 +74,7 @@
* cannot include sys/param.h and should only be updated here.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1600011
+#define __FreeBSD_version 1600012
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 6, 10:23 AM (18 m, 51 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29322440
Default Alt Text
D54833.id171897.diff (3 KB)
Attached To
Mode
D54833: kern: mac: add a prison_cleanup entry point
Attached
Detach File
Event Timeline
Log In to Comment