lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z9wxT9SV4BmehzmT@kernel.org>
Date: Thu, 20 Mar 2025 17:16:31 +0200
From: Jarkko Sakkinen <jarkko@...nel.org>
To: Bo Liu <liubo03@...pur.com>
Cc: dhowells@...hat.com, James.Bottomley@...senpartnership.com,
	zohar@...ux.ibm.com, paul@...l-moore.com, jmorris@...ei.org,
	serge@...lyn.com, linux-integrity@...r.kernel.org,
	keyrings@...r.kernel.org, linux-security-module@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KEYS: trusted: dcp: Use kfree_sensitive() to fix
 Coccinelle warnings

On Thu, Mar 20, 2025 at 06:35:57AM -0400, Bo Liu wrote:
> Replace memzero_explicit() and kfree() with kfree_sensitive() to fix
> warnings reported by Coccinelle:
> 
> WARNING opportunity for kfree_sensitive/kvfree_sensitive
> WARNING opportunity for kfree_sensitive/kvfree_sensitive

Even if you get the error from Coccinelle, you should still go trouble
why this warning happens. Otherwise, you are contributing a change that
you don't understand yourself.

> 
> Signed-off-by: Bo Liu <liubo03@...pur.com>
> ---
>  security/keys/trusted-keys/trusted_dcp.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/security/keys/trusted-keys/trusted_dcp.c b/security/keys/trusted-keys/trusted_dcp.c
> index 7b6eb655df0c..c967837e72ee 100644
> --- a/security/keys/trusted-keys/trusted_dcp.c
> +++ b/security/keys/trusted-keys/trusted_dcp.c
> @@ -233,8 +233,7 @@ static int trusted_dcp_seal(struct trusted_key_payload *p, char *datablob)
>  	ret = 0;
>  
>  out:
> -	memzero_explicit(plain_blob_key, AES_KEYSIZE_128);
> -	kfree(plain_blob_key);
> +	kfree_sensitive(plain_blob_key);
>  
>  	return ret;
>  }
> @@ -283,8 +282,7 @@ static int trusted_dcp_unseal(struct trusted_key_payload *p, char *datablob)
>  	ret = 0;
>  out:
>  	if (plain_blob_key) {
> -		memzero_explicit(plain_blob_key, AES_KEYSIZE_128);
> -		kfree(plain_blob_key);
> +		kfree_sensitive(plain_blob_key);
>  	}
>  
>  	return ret;
> -- 
> 2.31.1
> 

Not gonna fly because you did not include KEYS-TRUSTED-DCP maintainer to
the CC list.

BR, Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ