LSM: Tie enabling logic to presence in ordered list

Until now, any LSM without an enable storage variable was considered
enabled. This inverts the logic and sets defaults to true only if the
LSM gets added to the ordered initialization list. (And an exception
continues for the major LSMs until they are integrated into the ordered
initialization in a later patch.)

Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
Kees Cook 2018-10-09 14:42:57 -07:00
parent 79f7865d84
commit a8027fb0d1
2 changed files with 12 additions and 4 deletions

View file

@ -2047,7 +2047,7 @@ extern void security_add_hooks(struct security_hook_list *hooks, int count,
struct lsm_info {
const char *name; /* Required. */
unsigned long flags; /* Optional: flags describing LSM */
int *enabled; /* Optional: NULL means enabled. */
int *enabled; /* Optional: controlled by CONFIG_LSM */
int (*init)(void); /* Required. */
};