Skip to content

Commit

Permalink
LSM: Introduce LSM_FLAG_LEGACY_MAJOR
Browse files Browse the repository at this point in the history
This adds a flag for the current "major" LSMs to distinguish them when
we have a universal method for ordering all LSMs. It's called "legacy"
since the distinction of "major" will go away in the blob-sharing world.

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
Reviewed-by: John Johansen <john.johansen@canonical.com>
  • Loading branch information
Kees Cook committed Jan 8, 2019
1 parent bfeffd1 commit 47008e5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/linux/lsm_hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -2042,8 +2042,11 @@ extern char *lsm_names;
extern void security_add_hooks(struct security_hook_list *hooks, int count,
char *lsm);

#define LSM_FLAG_LEGACY_MAJOR BIT(0)

struct lsm_info {
const char *name; /* Required. */
unsigned long flags; /* Optional: flags describing LSM */
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 @@ -1729,5 +1729,6 @@ static int __init apparmor_init(void)

DEFINE_LSM(apparmor) = {
.name = "apparmor",
.flags = LSM_FLAG_LEGACY_MAJOR,
.init = apparmor_init,
};
1 change: 1 addition & 0 deletions security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -6999,6 +6999,7 @@ void selinux_complete_init(void)
all processes and objects when they are created. */
DEFINE_LSM(selinux) = {
.name = "selinux",
.flags = LSM_FLAG_LEGACY_MAJOR,
.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 @@ -4812,5 +4812,6 @@ static __init int smack_init(void)
*/
DEFINE_LSM(smack) = {
.name = "smack",
.flags = LSM_FLAG_LEGACY_MAJOR,
.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 @@ -552,5 +552,6 @@ static int __init tomoyo_init(void)

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

0 comments on commit 47008e5

Please sign in to comment.