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: <20250214084531.3299390-1-rppt@kernel.org>
Date: Fri, 14 Feb 2025 10:45:31 +0200
From: Mike Rapoport <rppt@...nel.org>
To: Luis Chamberlain <mcgrof@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>
Cc: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@...el.com>,
	Daniel Gomez <da.gomez@...sung.com>,
	Mike Rapoport <rppt@...nel.org>,
	Petr Pavlu <petr.pavlu@...e.com>,
	Sami Tolvanen <samitolvanen@...gle.com>,
	linux-kernel@...r.kernel.org,
	linux-modules@...r.kernel.org,
	x86@...nel.org
Subject: [PATCH] module: don't annotate ROX memory as kmemleak_not_leak()

From: "Mike Rapoport (Microsoft)" <rppt@...nel.org>

The ROX memory allocations are part of a larger vmalloc allocation and
annotating them with kmemleak_not_leak() confuses kmemleak.

Skip kmemleak_not_leak() annotations for the ROX areas.

Fixes: c287c0723329 ("module: switch to execmem API for remapping as RW and restoring ROX")
Fixes: 64f6a4e10c05 ("x86: re-enable EXECMEM_ROX support")
Reported-by: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@...el.com>
Signed-off-by: Mike Rapoport (Microsoft) <rppt@...nel.org>
---

Peter, can you take it via tip tree?
Or you prefer for Luis to pick this up?

 kernel/module/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/module/main.c b/kernel/module/main.c
index 974821d6e85a..3dbe23098433 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -1250,7 +1250,8 @@ static int module_memory_alloc(struct module *mod, enum mod_mem_type type)
 	 * *do* eventually get freed, but let's just keep things simple
 	 * and avoid *any* false positives.
 	 */
-	kmemleak_not_leak(ptr);
+	if (!mod->mem[type].is_rox)
+		kmemleak_not_leak(ptr);
 
 	memset(ptr, 0, size);
 	mod->mem[type].base = ptr;
-- 
2.47.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ