LSM: Record LSM name in struct lsm_info
authorKees Cook <keescook@chromium.org>
Thu, 11 Oct 2018 00:18:24 +0000 (17:18 -0700)
committerJames Morris <james.morris@microsoft.com>
Thu, 11 Oct 2018 03:40:22 +0000 (20:40 -0700)
In preparation for making LSM selections outside of the LSMs, include
the name of LSMs in struct lsm_info.

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: James Morris <james.morris@microsoft.com>
include/linux/lsm_hooks.h
security/apparmor/lsm.c
security/integrity/iint.c
security/selinux/hooks.c
security/smack/smack_lsm.c
security/tomoyo/tomoyo.c

index 9c6b4198ff5aaa42b8a8438d73a0147cfed27c39..ae159b02f3abffdfb452d17e4b12f8a117ee5056 100644 (file)
@@ -2040,6 +2040,7 @@ extern void security_add_hooks(struct security_hook_list *hooks, int count,
                                char *lsm);
 
 struct lsm_info {
+       const char *name;       /* Required. */
        int (*init)(void);      /* Required. */
 };
 
index c4863956c832fabf8f4aac2a433dc48fe189d307..dca4b7dbf3680d420232733d32d0bc5588c03ce2 100644 (file)
@@ -1607,5 +1607,6 @@ alloc_out:
 }
 
 DEFINE_LSM(apparmor) = {
+       .name = "apparmor",
        .init = apparmor_init,
 };
index 94e8e18207483ff494695e14044056863a21a667..1ea05da2323d16275e87d2ee7bd4013dc0e7fdec 100644 (file)
@@ -176,6 +176,7 @@ static int __init integrity_iintcache_init(void)
        return 0;
 }
 DEFINE_LSM(integrity) = {
+       .name = "integrity",
        .init = integrity_iintcache_init,
 };
 
index 6ca2e89ddbd6abef7414f90d3455e9ee79878343..9651bccae27071834edc8080076da4a2bcba2c49 100644 (file)
@@ -7203,6 +7203,7 @@ void selinux_complete_init(void)
 /* SELinux requires early initialization in order to label
    all processes and objects when they are created. */
 DEFINE_LSM(selinux) = {
+       .name = "selinux",
        .init = selinux_init,
 };
 
index c62e26939a698ab972ca6e4c72ee490f13b1159f..2fb56bcf1316ce6b187fe75ed231c54e8d8e5082 100644 (file)
@@ -4883,5 +4883,6 @@ static __init int smack_init(void)
  * all processes and objects when they are created.
  */
 DEFINE_LSM(smack) = {
+       .name = "smack",
        .init = smack_init,
 };
index b2d833999910fb75bb9a853471a8aec7f1aae93b..1b5b5097efd77a5ca12376f5066123125e20824e 100644 (file)
@@ -551,5 +551,6 @@ static int __init tomoyo_init(void)
 }
 
 DEFINE_LSM(tomoyo) = {
+       .name = "tomoyo",
        .init = tomoyo_init,
 };