[PATCH] apparmor: leverage audit_log_n_untrustedstring() when possible

John Johansen john.johansen at canonical.com
Tue Jul 21 01:41:00 UTC 2026


On 7/17/26 14:52, Paul Moore wrote:
> Make use of the audit_log_n_untrustedstring() function to simplify the
> code in aa_label_xaudit().
> 
> Signed-off-by: Paul Moore <paul at paul-moore.com>

Acked-by: John Johansen <john.johansen at canonical.com>

unless you object I will pull this into the apparmor tree


> ---
>   security/apparmor/label.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/security/apparmor/label.c b/security/apparmor/label.c
> index 3fd384d8c41a..a165cadf8249 100644
> --- a/security/apparmor/label.c
> +++ b/security/apparmor/label.c
> @@ -1743,10 +1743,7 @@ void aa_label_xaudit(struct audit_buffer *ab, struct aa_ns *ns,
>   		str = (char *) label->hname;
>   		len = strlen(str);
>   	}
> -	if (audit_string_contains_control(str, len))
> -		audit_log_n_hex(ab, str, len);
> -	else
> -		audit_log_n_string(ab, str, len);
> +	audit_log_n_untrustedstring(ab, str, len);
>   
>   	kfree(name);
>   }




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