Re: [PATCH v15 07/23] LSM: Use lsmblob in security_secid_to_secctx

Paul Moore
2020-03-07T01:18:21Z

On Fri, Feb 21, 2020 at 7:05 PM Casey Schaufler <casey@schaufler-ca.com> wrote:
>
> Change security_secid_to_secctx() to take a lsmblob as input
> instead of a u32 secid. It will then call the LSM hooks
> using the lsmblob element allocated for that module. The
> callers have been updated as well. This allows for the
> possibility that more than one module may be called upon
> to translate a secid to a string, as can occur in the
> audit code.
>
> Reviewed-by: Kees Cook <keescook@chromium.org>
> Reviewed-by: John Johansen <john.johansen@canonical.com>
> Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
> Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
> cc: netdev@vger.kernel.org
> ---
> drivers/android/binder.c | 4 +++-
> include/linux/security.h | 5 +++--
> include/net/scm.h | 5 ++---
> kernel/audit.c | 9 +++++++--
> kernel/auditsc.c | 14 ++++++++++----
> net/ipv4/ip_sockglue.c | 3 +--
> net/netfilter/nf_conntrack_netlink.c | 8 ++++++--
> net/netfilter/nf_conntrack_standalone.c | 4 +++-
> net/netfilter/nfnetlink_queue.c | 8 ++++++--
> net/netlabel/netlabel_unlabeled.c | 18 ++++++++++++++----
> net/netlabel/netlabel_user.c | 6 +++---
> security/security.c | 16 +++++++++++++---
> 12 files changed, 71 insertions(+), 29 deletions(-)

More of the lsmblob_init()/dosomething() pattern.

I'm sure this will all change later (and peeking ahead, it looks like
most of it does), but I think it needs to be better documented in
these commits about what is temporary and what is intended to stick
around. Imagine years later bisecting down to this patch and trying
to make sense of why it was done this way.

I realize that it is hard to make individual patches do something
meaningful when you are making such sweeping changes, but in these
cases you need to document it until there is no doubt about why this
patch exists.

--
paul moore