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: <20250715-kmemleak_efi-v1-1-c07e68c76ae8@debian.org>
Date: Tue, 15 Jul 2025 02:28:19 -0700
From: Breno Leitao <leitao@...ian.org>
To: Jeremy Kerr <jk@...abs.org>, Ard Biesheuvel <ardb@...nel.org>
Cc: linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org, 
 kernel-team@...a.com, Breno Leitao <leitao@...ian.org>
Subject: [PATCH] efivarfs: Suppress false-positive kmemleak warning for sfi

When kmemleak is enabled, it incorrectly reports the sfi structure
allocated during efivarfs_init_fs_context() as leaked:

    unreferenced object 0xffff888146250b80 (size 64):
    __kmalloc_cache_noprof
    efivarfs_init_fs_context
    ...

On module unload, this object is freed in efivarfs_kill_sb(), confirming
no actual leak. Also, kfree(sfi) is called at efivarfs_kill_sb(). I am
not able to explain why kmemleak detected it as a leak. To silence this
false-positive, mark the sfi allocation as ignored by kmemleak right
after allocation.

This ensures clearer leak diagnostics for this allocation path.

Signed-off-by: Breno Leitao <leitao@...ian.org>
---
 fs/efivarfs/super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
index c900d98bf4945..5f867ad2005ae 100644
--- a/fs/efivarfs/super.c
+++ b/fs/efivarfs/super.c
@@ -19,6 +19,7 @@
 #include <linux/notifier.h>
 #include <linux/printk.h>
 #include <linux/namei.h>
+#include <linux/kmemleak.h>
 
 #include "internal.h"
 #include "../internal.h"
@@ -498,6 +499,7 @@ static int efivarfs_init_fs_context(struct fs_context *fc)
 	if (!sfi)
 		return -ENOMEM;
 
+	kmemleak_ignore(sfi);
 	sfi->mount_opts.uid = GLOBAL_ROOT_UID;
 	sfi->mount_opts.gid = GLOBAL_ROOT_GID;
 

---
base-commit: 8c2e52ebbe885c7eeaabd3b7ddcdc1246fc400d2
change-id: 20250714-kmemleak_efi-bedfe48a304d

Best regards,
--  
Breno Leitao <leitao@...ian.org>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ