Skip to content

Commit d6aed64

Browse files
committed
Yama: Initialize as ordered LSM
This converts Yama from being a direct "minor" LSM into an ordered LSM. Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
1 parent 70b62c2 commit d6aed64

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎include/linux/lsm_hooks.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,10 +2090,5 @@ static inline void security_delete_hooks(struct security_hook_list *hooks,
20902090
#endif /* CONFIG_SECURITY_WRITABLE_HOOKS */
20912091

20922092
extern void __init capability_add_hooks(void);
2093-
#ifdef CONFIG_SECURITY_YAMA
2094-
extern void __init yama_add_hooks(void);
2095-
#else
2096-
static inline void __init yama_add_hooks(void) { }
2097-
#endif
20982093

20992094
#endif /* ! __LINUX_LSM_HOOKS_H */

‎security/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ source "security/integrity/Kconfig"
241241

242242
config LSM
243243
string "Ordered list of enabled LSMs"
244-
default "loadpin,integrity,selinux,smack,tomoyo,apparmor"
244+
default "yama,loadpin,integrity,selinux,smack,tomoyo,apparmor"
245245
help
246246
A comma-separated list of LSMs, in initialization order.
247247
Any LSMs left off this list will be ignored. This can be

‎security/security.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ int __init security_init(void)
274274
* Load minor LSMs, with the capability module always first.
275275
*/
276276
capability_add_hooks();
277-
yama_add_hooks();
278277

279278
/* Load LSMs in specified order. */
280279
ordered_lsm_init();

‎security/yama/yama_lsm.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,15 @@ static void __init yama_init_sysctl(void)
477477
static inline void yama_init_sysctl(void) { }
478478
#endif /* CONFIG_SYSCTL */
479479

480-
void __init yama_add_hooks(void)
480+
static int __init yama_init(void)
481481
{
482482
pr_info("Yama: becoming mindful.\n");
483483
security_add_hooks(yama_hooks, ARRAY_SIZE(yama_hooks), "yama");
484484
yama_init_sysctl();
485+
return 0;
485486
}
487+
488+
DEFINE_LSM(yama) = {
489+
.name = "yama",
490+
.init = yama_init,
491+
};

0 commit comments

Comments
 (0)