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-next>] [day] [month] [year] [list]
Message-ID: <20250706092859.412471-1-thorsten.blum@linux.dev>
Date: Sun,  6 Jul 2025 11:28:44 +0200
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Borislav Petkov <bp@...en8.de>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	x86@...nel.org,
	"H. Peter Anvin" <hpa@...or.com>,
	Tom Lendacky <thomas.lendacky@....com>,
	Nikunj A Dadhania <nikunj@....com>,
	Ard Biesheuvel <ardb@...nel.org>,
	Alexey Kardashevskiy <aik@....com>,
	Ashish Kalra <ashish.kalra@....com>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
	kernel test robot <lkp@...el.com>,
	Ingo Molnar <mingo@...nel.org>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] x86/sev: Replace memset(0) and kfree() with kfree_sensitive()

Replace memset(0) followed by kfree() with kfree_sensitive() to improve
snp_msg_free() and silence the following Coccinelle/coccicheck warning
reported by kfree_sensitive.cocci:

  WARNING opportunity for kfree_sensitive/kvfree_sensitive

No functional changes intended.

Reported-by: kernel test robot <lkp@...el.com>
Closes: https://lore.kernel.org/r/202501141317.IrSGK4Et-lkp@intel.com/
Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
---
 arch/x86/coco/sev/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c
index b6db4e0b936b..4bc8423cfd79 100644
--- a/arch/x86/coco/sev/core.c
+++ b/arch/x86/coco/sev/core.c
@@ -1768,8 +1768,7 @@ void snp_msg_free(struct snp_msg_desc *mdesc)
 	free_shared_pages(mdesc->request, sizeof(struct snp_guest_msg));
 	iounmap((__force void __iomem *)mdesc->secrets);
 
-	memset(mdesc, 0, sizeof(*mdesc));
-	kfree(mdesc);
+	kfree_sensitive(mdesc);
 }
 EXPORT_SYMBOL_GPL(snp_msg_free);
 
-- 
2.50.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ