aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/policydb.h
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2011-04-28 15:11:21 -0400
committerEric Paris <eparis@redhat.com>2011-04-28 15:15:53 -0400
commit2463c26d50adc282d19317013ba0ff473823ca47 (patch)
treee92438150bb380c0dc0867b00f1ae89f73646b2a /security/selinux/ss/policydb.h
parent3f058ef7787e1b48720622346de9a5317aeb749a (diff)
SELinux: put name based create rules in a hashtable
To shorten the list we need to run if filename trans rules exist for the type of the given parent directory I put them in a hashtable. Given the policy we are expecting to use in Fedora this takes the worst case list run from about 5,000 entries to 17. Signed-off-by: Eric Paris <eparis@redhat.com> Reviewed-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/selinux/ss/policydb.h')
-rw-r--r--security/selinux/ss/policydb.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/security/selinux/ss/policydb.h b/security/selinux/ss/policydb.h
index f054a9d4d114..b846c0387180 100644
--- a/security/selinux/ss/policydb.h
+++ b/security/selinux/ss/policydb.h
@@ -79,11 +79,13 @@ struct role_trans {
79}; 79};
80 80
81struct filename_trans { 81struct filename_trans {
82 struct filename_trans *next;
83 u32 stype; /* current process */ 82 u32 stype; /* current process */
84 u32 ttype; /* parent dir context */ 83 u32 ttype; /* parent dir context */
85 u16 tclass; /* class of new object */ 84 u16 tclass; /* class of new object */
86 const char *name; /* last path component */ 85 const char *name; /* last path component */
86};
87
88struct filename_trans_datum {
87 u32 otype; /* expected of new object */ 89 u32 otype; /* expected of new object */
88}; 90};
89 91
@@ -227,10 +229,11 @@ struct policydb {
227 /* role transitions */ 229 /* role transitions */
228 struct role_trans *role_tr; 230 struct role_trans *role_tr;
229 231
232 /* file transitions with the last path component */
230 /* quickly exclude lookups when parent ttype has no rules */ 233 /* quickly exclude lookups when parent ttype has no rules */
231 struct ebitmap filename_trans_ttypes; 234 struct ebitmap filename_trans_ttypes;
232 /* file transitions with the last path component */ 235 /* actual set of filename_trans rules */
233 struct filename_trans *filename_trans; 236 struct hashtab *filename_trans;
234 237
235 /* bools indexed by (value - 1) */ 238 /* bools indexed by (value - 1) */
236 struct cond_bool_datum **bool_val_to_struct; 239 struct cond_bool_datum **bool_val_to_struct;