[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8dd6f4e0-07f0-333e-0663-0bc0889cccf2@schaufler-ca.com>
Date: Tue, 28 Jul 2020 16:41:59 -0700
From: Casey Schaufler <casey@...aufler-ca.com>
To: John Johansen <john.johansen@...onical.com>,
casey.schaufler@...el.com, jmorris@...ei.org,
linux-security-module@...r.kernel.org, selinux@...r.kernel.org
Cc: linux-audit@...hat.com, keescook@...omium.org,
penguin-kernel@...ove.sakura.ne.jp, paul@...l-moore.com,
sds@...ho.nsa.gov, netdev@...r.kernel.org,
Casey Schaufler <casey@...aufler-ca.com>
Subject: Re: [PATCH v19 06/23] LSM: Use lsmblob in security_secctx_to_secid
On 7/28/2020 4:11 AM, John Johansen wrote:
> On 7/24/20 1:32 PM, Casey Schaufler wrote:
>> Change security_secctx_to_secid() to fill in a lsmblob instead
>> of a u32 secid. Multiple LSMs may be able to interpret the
>> string, and this allows for setting whichever secid is
>> appropriate. Change security_secmark_relabel_packet() to use a
>> lsmblob instead of a u32 secid. In some other cases there is
>> scaffolding where interfaces have yet to be converted.
>>
>> Reviewed-by: Kees Cook <keescook@...omium.org>
>> Signed-off-by: Casey Schaufler <casey@...aufler-ca.com>
>> Cc: netdev@...r.kernel.org
> one comment below, but its a nice to have so
>
> Reviewed-by: John Johansen <john.johansen@...onical.com>
>
>
>> ---
>> include/linux/security.h | 30 +++++++++++++++++++++++----
>> include/net/scm.h | 7 +++++--
>> kernel/cred.c | 4 +---
>> net/ipv4/ip_sockglue.c | 6 ++++--
>> net/netfilter/nft_meta.c | 18 +++++++++-------
>> net/netfilter/xt_SECMARK.c | 9 ++++++--
>> net/netlabel/netlabel_unlabeled.c | 23 +++++++++++++--------
>> security/security.c | 34 ++++++++++++++++++++++++++-----
>> 8 files changed, 98 insertions(+), 33 deletions(-)
>>
>> diff --git a/include/linux/security.h b/include/linux/security.h
>> index d81e8886d799..98176faaaba5 100644
>> --- a/include/linux/security.h
>> +++ b/include/linux/security.h
>> @@ -189,6 +189,27 @@ static inline bool lsmblob_equal(struct lsmblob *bloba, struct lsmblob *blobb)
>> return !memcmp(bloba, blobb, sizeof(*bloba));
>> }
>>
>> +/**
>> + * lsmblob_value - find the first non-zero value in an lsmblob structure.
>> + * @blob: Pointer to the data
>> + *
>> + * This needs to be used with extreme caution, as the cases where
>> + * it is appropriate are rare.
>> + *
>> + * Return the first secid value set in the lsmblob.
>> + * There should only be one.
> It would be really nice if we could have an LSM debug config, that would
> do things like checking there is indeed only one value when this fn
> is called.
I can't see a CONFIG_LSM_DEBUG for this alone, but if you have
other places you'd like to see it I'm open to it.
Powered by blists - more mailing lists