• Home
  • Raw
  • Download

Lines Matching refs:lsm

64 static bool __init is_enabled(struct lsm_info *lsm)  in is_enabled()  argument
66 if (!lsm->enabled) in is_enabled()
69 return *lsm->enabled; in is_enabled()
75 static void __init set_enabled(struct lsm_info *lsm, bool enabled) in set_enabled() argument
81 if (!lsm->enabled) { in set_enabled()
83 lsm->enabled = &lsm_enabled_true; in set_enabled()
85 lsm->enabled = &lsm_enabled_false; in set_enabled()
86 } else if (lsm->enabled == &lsm_enabled_true) { in set_enabled()
88 lsm->enabled = &lsm_enabled_false; in set_enabled()
89 } else if (lsm->enabled == &lsm_enabled_false) { in set_enabled()
91 lsm->enabled = &lsm_enabled_true; in set_enabled()
93 *lsm->enabled = enabled; in set_enabled()
98 static bool __init exists_ordered_lsm(struct lsm_info *lsm) in exists_ordered_lsm() argument
103 if (*check == lsm) in exists_ordered_lsm()
111 static void __init append_ordered_lsm(struct lsm_info *lsm, const char *from) in append_ordered_lsm() argument
114 if (exists_ordered_lsm(lsm)) in append_ordered_lsm()
121 if (!lsm->enabled) in append_ordered_lsm()
122 lsm->enabled = &lsm_enabled_true; in append_ordered_lsm()
123 ordered_lsms[last_lsm++] = lsm; in append_ordered_lsm()
125 init_debug("%s ordering: %s (%sabled)\n", from, lsm->name, in append_ordered_lsm()
126 is_enabled(lsm) ? "en" : "dis"); in append_ordered_lsm()
130 static bool __init lsm_allowed(struct lsm_info *lsm) in lsm_allowed() argument
133 if (!is_enabled(lsm)) in lsm_allowed()
137 if ((lsm->flags & LSM_FLAG_EXCLUSIVE) && exclusive) { in lsm_allowed()
138 init_debug("exclusive disabled: %s\n", lsm->name); in lsm_allowed()
176 static void __init prepare_lsm(struct lsm_info *lsm) in prepare_lsm() argument
178 int enabled = lsm_allowed(lsm); in prepare_lsm()
181 set_enabled(lsm, enabled); in prepare_lsm()
185 if ((lsm->flags & LSM_FLAG_EXCLUSIVE) && !exclusive) { in prepare_lsm()
186 exclusive = lsm; in prepare_lsm()
187 init_debug("exclusive chosen: %s\n", lsm->name); in prepare_lsm()
190 lsm_set_blob_sizes(lsm->blobs); in prepare_lsm()
195 static void __init initialize_lsm(struct lsm_info *lsm) in initialize_lsm() argument
197 if (is_enabled(lsm)) { in initialize_lsm()
200 init_debug("initializing %s\n", lsm->name); in initialize_lsm()
201 ret = lsm->init(); in initialize_lsm()
202 WARN(ret, "%s failed to initialize: %d\n", lsm->name, ret); in initialize_lsm()
209 struct lsm_info *lsm; in ordered_lsm_parse() local
213 for (lsm = __start_lsm_info; lsm < __end_lsm_info; lsm++) { in ordered_lsm_parse()
214 if (lsm->order == LSM_ORDER_FIRST) in ordered_lsm_parse()
215 append_ordered_lsm(lsm, "first"); in ordered_lsm_parse()
245 for (lsm = __start_lsm_info; lsm < __end_lsm_info; lsm++) { in ordered_lsm_parse()
246 if (lsm->order == LSM_ORDER_MUTABLE && in ordered_lsm_parse()
247 strcmp(lsm->name, name) == 0) { in ordered_lsm_parse()
248 append_ordered_lsm(lsm, origin); in ordered_lsm_parse()
259 for (lsm = __start_lsm_info; lsm < __end_lsm_info; lsm++) { in ordered_lsm_parse()
260 if (exists_ordered_lsm(lsm)) in ordered_lsm_parse()
262 if (strcmp(lsm->name, chosen_major_lsm) == 0) in ordered_lsm_parse()
263 append_ordered_lsm(lsm, "security="); in ordered_lsm_parse()
268 for (lsm = __start_lsm_info; lsm < __end_lsm_info; lsm++) { in ordered_lsm_parse()
269 if (exists_ordered_lsm(lsm)) in ordered_lsm_parse()
271 set_enabled(lsm, false); in ordered_lsm_parse()
272 init_debug("%s disabled: %s\n", origin, lsm->name); in ordered_lsm_parse()
285 struct lsm_info **lsm; in ordered_lsm_init() local
299 for (lsm = ordered_lsms; *lsm; lsm++) in ordered_lsm_init()
300 prepare_lsm(*lsm); in ordered_lsm_init()
323 for (lsm = ordered_lsms; *lsm; lsm++) in ordered_lsm_init()
324 initialize_lsm(*lsm); in ordered_lsm_init()
333 struct lsm_info *lsm; in early_security_init() local
339 for (lsm = __start_early_lsm_info; lsm < __end_early_lsm_info; lsm++) { in early_security_init()
340 if (!lsm->enabled) in early_security_init()
341 lsm->enabled = &lsm_enabled_true; in early_security_init()
342 prepare_lsm(lsm); in early_security_init()
343 initialize_lsm(lsm); in early_security_init()
356 struct lsm_info *lsm; in security_init() local
364 for (lsm = __start_early_lsm_info; lsm < __end_early_lsm_info; lsm++) { in security_init()
365 if (lsm->enabled) in security_init()
366 lsm_append(lsm->name, &lsm_names); in security_init()
399 static bool match_last_lsm(const char *list, const char *lsm) in match_last_lsm() argument
403 if (WARN_ON(!list || !lsm)) in match_last_lsm()
411 return !strcmp(last, lsm); in match_last_lsm()
444 char *lsm) in security_add_hooks() argument
449 hooks[i].lsm = lsm; in security_add_hooks()
458 if (lsm_append(lsm, &lsm_names) < 0) in security_add_hooks()
1879 int security_getprocattr(struct task_struct *p, const char *lsm, char *name, in security_getprocattr() argument
1885 if (lsm != NULL && strcmp(lsm, hp->lsm)) in security_getprocattr()
1892 int security_setprocattr(const char *lsm, const char *name, void *value, in security_setprocattr() argument
1898 if (lsm != NULL && strcmp(lsm, hp->lsm)) in security_setprocattr()