Re: [PATCH 07/18] LSM: Add minor LSM initialization loop

From: Kees Cook
Date: Sat Sep 15 2018 - 21:49:24 EST


On Sat, Sep 15, 2018 at 6:27 PM, Jann Horn <jannh@xxxxxxxxxx> wrote:
> On Sun, Sep 16, 2018 at 3:11 AM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>> Split initialization loop into two phases: "exclusive" LSMs and "minor"
>> LSMs.
>>
>> Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
>> ---
>> include/linux/lsm_hooks.h | 6 ++++++
>> security/security.c | 8 +++++---
>> 2 files changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
>> index f8e618e2bdd2..ec3419b9b16f 100644
>> --- a/include/linux/lsm_hooks.h
>> +++ b/include/linux/lsm_hooks.h
>> @@ -2039,7 +2039,13 @@ extern char *lsm_names;
>> extern void security_add_hooks(struct security_hook_list *hooks, int count,
>> char *lsm);
>>
>> +enum lsm_type {
>> + LSM_TYPE_EXCLUSIVE = 0,
>> + LSM_TYPE_MINOR,
>> +};
>
> Is the intent of this explicit zero assignment that LSM_TYPE_EXCLUSIVE
> should be the default? If so, perhaps a comment "/* default */", or
> something like that, might be helpful.

You cut the patch quote off where I do exactly that:

>> + enum lsm_type type; /* Optional: default is LSM_TYPE_EXCLUSIVE */

:)

-Kees

--
Kees Cook
Pixel Security