Skip to content

Commit

Permalink
LSM: Record LSM name in struct lsm_info
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kees Cook authored and James Morris committed Oct 11, 2018
1 parent 3d6e5f6 commit 07aed2f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/linux/lsm_hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
};

Expand Down
1 change: 1 addition & 0 deletions security/apparmor/lsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1607,5 +1607,6 @@ static int __init apparmor_init(void)
}

DEFINE_LSM(apparmor) = {
.name = "apparmor",
.init = apparmor_init,
};
1 change: 1 addition & 0 deletions security/integrity/iint.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ static int __init integrity_iintcache_init(void)
return 0;
}
DEFINE_LSM(integrity) = {
.name = "integrity",
.init = integrity_iintcache_init,
};

Expand Down
1 change: 1 addition & 0 deletions security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
1 change: 1 addition & 0 deletions security/smack/smack_lsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
1 change: 1 addition & 0 deletions security/tomoyo/tomoyo.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,5 +551,6 @@ static int __init tomoyo_init(void)
}

DEFINE_LSM(tomoyo) = {
.name = "tomoyo",
.init = tomoyo_init,
};

0 comments on commit 07aed2f

Please sign in to comment.