[PATCH v7 01/28] lsm: Add audit_log_lsm_data() helper

Günther Noack gnoack3000 at gmail.com
Tue Mar 25 19:35:43 UTC 2025


On Thu, Mar 20, 2025 at 08:06:50PM +0100, Mickaël Salaün wrote:
> diff --git a/security/lsm_audit.c b/security/lsm_audit.c
> index 52db886dbba8..a61c7ebdb6a7 100644
> --- a/security/lsm_audit.c
> +++ b/security/lsm_audit.c
> @@ -431,6 +425,21 @@ static void dump_common_audit_data(struct audit_buffer *ab,
>  	} /* switch (a->type) */
>  }
>  
> +/**
> + * dump_common_audit_data - helper to dump common audit data
> + * @ab : the audit buffer
> + * @a : common audit data
> + */

I was tempted to remark on the unusual documentation style with the
extra space before the colon, but I see that it has prior art in the
same file...

> +static void dump_common_audit_data(struct audit_buffer *ab,
> +				   const struct common_audit_data *a)
> +{
> +	char comm[sizeof(current->comm)];
> +
> +	audit_log_format(ab, " pid=%d comm=", task_tgid_nr(current));
> +	audit_log_untrustedstring(ab, get_task_comm(comm, current));
> +	audit_log_lsm_data(ab, a);
> +}
> +
>  /**
>   * common_lsm_audit - generic LSM auditing function
>   * @a:  auxiliary audit data
> -- 
> 2.49.0
> 

Reviewed-by: Günther Noack <gnoack3000 at gmail.com>




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