Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156446432
D39589.id120378.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D39589.id120378.diff
View Options
diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c
--- a/sys/security/mac/mac_framework.c
+++ b/sys/security/mac/mac_framework.c
@@ -519,7 +519,8 @@
static int
mac_policy_register(struct mac_policy_conf *mpc)
{
- struct mac_policy_conf *tmpc;
+ struct mac_policy_list_head *mpc_list;
+ struct mac_policy_conf *last_mpc, *tmpc;
int error, slot, static_entry;
error = 0;
@@ -539,19 +540,14 @@
static_entry = (!mac_late &&
!(mpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_UNLOADOK));
- if (static_entry) {
- LIST_FOREACH(tmpc, &mac_static_policy_list, mpc_list) {
- if (strcmp(tmpc->mpc_name, mpc->mpc_name) == 0) {
- error = EEXIST;
- goto out;
- }
- }
- } else {
- LIST_FOREACH(tmpc, &mac_policy_list, mpc_list) {
- if (strcmp(tmpc->mpc_name, mpc->mpc_name) == 0) {
- error = EEXIST;
- goto out;
- }
+ mpc_list = (static_entry) ? &mac_static_policy_list :
+ &mac_policy_list;
+ last_mpc = NULL;
+ LIST_FOREACH(tmpc, mpc_list, mpc_list) {
+ last_mpc = tmpc;
+ if (strcmp(tmpc->mpc_name, mpc->mpc_name) == 0) {
+ error = EEXIST;
+ goto out;
}
}
if (mpc->mpc_field_off != NULL) {
@@ -571,12 +567,12 @@
* it has to go into the dynamic list. If we're loading it before
* we've finished initializing, it can go into the static list with
* weaker locker requirements.
+ * In either case we should respect module dependencies.
*/
- if (static_entry)
- LIST_INSERT_HEAD(&mac_static_policy_list, mpc, mpc_list);
+ if (last_mpc == NULL)
+ LIST_INSERT_HEAD(mpc_list, mpc, mpc_list);
else
- LIST_INSERT_HEAD(&mac_policy_list, mpc, mpc_list);
-
+ LIST_INSERT_AFTER(last_mpc, mpc, mpc_list);
/*
* Per-policy initialization. Currently, this takes place under the
* exclusive lock, so policies must not sleep in their init method.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, May 14, 6:14 PM (49 m, 3 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33052642
Default Alt Text
D39589.id120378.diff (1 KB)
Attached To
Mode
D39589: Honor module dependency order when registering MAC modules.
Attached
Detach File
Event Timeline
Log In to Comment