diff options
author | Kees Cook <keescook@chromium.org> | 2018-10-10 20:18:21 -0400 |
---|---|---|
committer | James Morris <james.morris@microsoft.com> | 2018-10-10 23:40:21 -0400 |
commit | 5b89c1bd4c7e5c5ca8c5374fde35ecee6e16496c (patch) | |
tree | 1149bf533d702366169684a6ea71254f2d8917d6 /security | |
parent | 6907e3746fa1b9b685230098266bbeba99b93c7d (diff) |
LSM: Convert from initcall to struct lsm_info
In preparation for doing more interesting LSM init probing, this converts
the existing initcall system into an explicit call into a function pointer
from a section-collected struct lsm_info array.
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
Reviewed-by: James Morris <james.morris@microsoft.com>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: James Morris <james.morris@microsoft.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/integrity/iint.c | 1 | ||||
-rw-r--r-- | security/security.c | 14 |
2 files changed, 6 insertions, 9 deletions
diff --git a/security/integrity/iint.c b/security/integrity/iint.c index 5a6810041e5c..70d21b566955 100644 --- a/security/integrity/iint.c +++ b/security/integrity/iint.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/file.h> | 22 | #include <linux/file.h> |
23 | #include <linux/uaccess.h> | 23 | #include <linux/uaccess.h> |
24 | #include <linux/security.h> | 24 | #include <linux/security.h> |
25 | #include <linux/lsm_hooks.h> | ||
25 | #include "integrity.h" | 26 | #include "integrity.h" |
26 | 27 | ||
27 | static struct rb_root integrity_iint_tree = RB_ROOT; | 28 | static struct rb_root integrity_iint_tree = RB_ROOT; |
diff --git a/security/security.c b/security/security.c index 41a5da2c7faf..e74f46fba591 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -43,16 +43,12 @@ char *lsm_names; | |||
43 | static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1] = | 43 | static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1] = |
44 | CONFIG_DEFAULT_SECURITY; | 44 | CONFIG_DEFAULT_SECURITY; |
45 | 45 | ||
46 | static void __init do_security_initcalls(void) | 46 | static void __init major_lsm_init(void) |
47 | { | 47 | { |
48 | initcall_t call; | 48 | struct lsm_info *lsm; |
49 | initcall_entry_t *ce; | ||
50 | 49 | ||
51 | ce = __start_lsm_info; | 50 | for (lsm = __start_lsm_info; lsm < __end_lsm_info; lsm++) { |
52 | while (ce < __end_lsm_info) { | 51 | lsm->init(); |
53 | call = initcall_from_entry(ce); | ||
54 | call(); | ||
55 | ce++; | ||
56 | } | 52 | } |
57 | } | 53 | } |
58 | 54 | ||
@@ -82,7 +78,7 @@ int __init security_init(void) | |||
82 | /* | 78 | /* |
83 | * Load all the remaining security modules. | 79 | * Load all the remaining security modules. |
84 | */ | 80 | */ |
85 | do_security_initcalls(); | 81 | major_lsm_init(); |
86 | 82 | ||
87 | return 0; | 83 | return 0; |
88 | } | 84 | } |