@@ -2039,8 +2039,11 @@ extern char *lsm_names;
extern void security_add_hooks(struct security_hook_list *hooks, int count,
char *lsm);
+#define LSM_FLAG_LEGACY_MAJOR (1 << 0)
+
struct lsm_info {
const char *name; /* Populated automatically. */
+ unsigned long flags; /* Optional: flags describing LSM */
int (*init)(void);
};
@@ -1607,5 +1607,6 @@ static int __init apparmor_init(void)
}
DEFINE_LSM(apparmor)
+ .flags = LSM_FLAG_LEGACY_MAJOR,
.init = apparmor_init,
END_LSM;
@@ -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)
+ .flags = LSM_FLAG_LEGACY_MAJOR,
.init = selinux_init,
END_LSM;
@@ -4883,5 +4883,6 @@ static __init int smack_init(void)
* all processes and objects when they are created.
*/
DEFINE_LSM(smack)
+ .flags = LSM_FLAG_LEGACY_MAJOR,
.init = smack_init,
END_LSM;
@@ -551,5 +551,6 @@ static int __init tomoyo_init(void)
}
DEFINE_LSM(tomoyo)
+ .flags = LSM_FLAG_LEGACY_MAJOR,
.init = tomoyo_init,
END_LSM;
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> --- include/linux/lsm_hooks.h | 3 +++ security/apparmor/lsm.c | 1 + security/selinux/hooks.c | 1 + security/smack/smack_lsm.c | 1 + security/tomoyo/tomoyo.c | 1 + 5 files changed, 7 insertions(+)