summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2018-09-15 01:37:20 +0300
committerKees Cook <keescook@chromium.org>2019-01-09 00:18:43 +0300
commitd6aed64b74b73b64278c059eacd59d87167aa968 (patch)
tree0fd4b2e95d633d09a9f3d7e3711aeab68d328e88 /security
parent70b62c25665f636c9f6c700b26af7df296b0887e (diff)
downloadlinux-d6aed64b74b73b64278c059eacd59d87167aa968.tar.xz
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>
Diffstat (limited to 'security')
-rw-r--r--security/Kconfig2
-rw-r--r--security/security.c1
-rw-r--r--security/yama/yama_lsm.c8
3 files changed, 8 insertions, 3 deletions
diff --git a/security/Kconfig b/security/Kconfig
index 2cd737ba7660..78dc12b7eeb3 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -241,7 +241,7 @@ source "security/integrity/Kconfig"
config LSM
string "Ordered list of enabled LSMs"
- default "loadpin,integrity,selinux,smack,tomoyo,apparmor"
+ default "yama,loadpin,integrity,selinux,smack,tomoyo,apparmor"
help
A comma-separated list of LSMs, in initialization order.
Any LSMs left off this list will be ignored. This can be
diff --git a/security/security.c b/security/security.c
index b8d75f5a948d..35f93b7c585b 100644
--- a/security/security.c
+++ b/security/security.c
@@ -274,7 +274,6 @@ int __init security_init(void)
* Load minor LSMs, with the capability module always first.
*/
capability_add_hooks();
- yama_add_hooks();
/* Load LSMs in specified order. */
ordered_lsm_init();
diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c
index ffda91a4a1aa..eb1da1303d2e 100644
--- a/security/yama/yama_lsm.c
+++ b/security/yama/yama_lsm.c
@@ -477,9 +477,15 @@ static void __init yama_init_sysctl(void)
static inline void yama_init_sysctl(void) { }
#endif /* CONFIG_SYSCTL */
-void __init yama_add_hooks(void)
+static int __init yama_init(void)
{
pr_info("Yama: becoming mindful.\n");
security_add_hooks(yama_hooks, ARRAY_SIZE(yama_hooks), "yama");
yama_init_sysctl();
+ return 0;
}
+
+DEFINE_LSM(yama) = {
+ .name = "yama",
+ .init = yama_init,
+};