[PATCH 22/58] Audit: Change audit_sig_sid to audit_sig_lsm

Kees Cook keescook at chromium.org
Sun Jun 2 02:03:02 UTC 2019


On Fri, May 31, 2019 at 04:09:44PM -0700, Casey Schaufler wrote:
> Remove lsm_export scaffolding around audit_sig_sid by
> changing the u32 secid into an lsm_export structure named
> audit_sig_lsm.
> 
> Signed-off-by: Casey Schaufler <casey at schaufler-ca.com>
> ---
>  include/linux/security.h |  7 +++++++
>  kernel/audit.c           | 18 ++++++++----------
>  kernel/audit.h           |  2 +-
>  kernel/auditsc.c         |  3 +--
>  4 files changed, 17 insertions(+), 13 deletions(-)
> 
> diff --git a/include/linux/security.h b/include/linux/security.h
> index 40aa7b9f3c83..e76d7a9dbe50 100644
> --- a/include/linux/security.h
> +++ b/include/linux/security.h
> @@ -93,6 +93,13 @@ static inline void lsm_export_init(struct lsm_export *l)
>  	memset(l, 0, sizeof(*l));
>  }
>  
> +static inline bool lsm_export_any(struct lsm_export *l)
> +{
> +	return (((l->flags & LSM_EXPORT_SELINUX) && l->selinux) ||
> +		((l->flags & LSM_EXPORT_SMACK) && l->smack) ||
> +		((l->flags & LSM_EXPORT_APPARMOR) && l->apparmor));
> +}

All of these helpers need kerndoc.

Bikeshed on naming:
- struct lsm_export renamed to lsm_secid
- lsm_export_any renamed to lsm_secid_defined() or ..._is_set() or
  ..._non_zero() ?

-- 
Kees Cook



More information about the Linux-security-module-archive mailing list