6 #include <linux/kernel.h>
7 #include <linux/slab.h>
9 #include <linux/errno.h>
14 #define SIDTAB_HASH(sid) \
15 (sid & SIDTAB_HASH_MASK)
46 while (cur && sid > cur->
sid) {
51 if (cur && sid == cur->
sid) {
57 if (newnode ==
NULL) {
62 if (context_cpy(&newnode->
context, context)) {
75 s->
htable[hvalue] = newnode;
95 while (cur && sid > cur->
sid)
98 if (force && cur && sid == cur->
sid && cur->
context.len)
103 sid = SECINITSID_UNLABELED;
106 while (cur && sid > cur->
sid)
108 if (!cur || sid != cur->
sid)
117 return sidtab_search_core(s, sid, 0);
122 return sidtab_search_core(s, sid, 1);
126 int (*apply) (
u32 sid,
161 static inline u32 sidtab_search_context(
struct sidtab *s,
170 if (context_cmp(&cur->
context, context)) {
180 static inline u32 sidtab_search_cache(
struct sidtab *s,
struct context *context)
189 if (context_cmp(&node->
context, context)) {
190 sidtab_update_cache(s, node, i);
198 struct context *context,
207 sid = sidtab_search_cache(s, context);
209 sid = sidtab_search_context(s, context);
213 sid = sidtab_search_context(s, context);
224 "SELinux: Context %s is not valid (left unmapped).\n",
230 spin_unlock_irqrestore(&s->
lock, flags);
242 int i, chain_len, slots_used, max_chain_len;
257 if (chain_len > max_chain_len)
258 max_chain_len = chain_len;
263 "chain length %d\n", tag, h->
nel, slots_used, SIDTAB_SIZE,
280 context_destroy(&temp->
context);
303 spin_unlock_irqrestore(&src->
lock, flags);
312 spin_unlock_irqrestore(&s->
lock, flags);