lkml.org 
[lkml]   [2013]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: V3.10-rc1 memory leak
From
Date
On Wed, 2013-05-15 at 15:37 +0100, Catalin Marinas wrote:

> >From 0621c7e1909ea86bf8499a0ffe5ea59d1007ee8c Mon Sep 17 00:00:00 2001
> From: Catalin Marinas <catalin.marinas@arm.com>
> Date: Wed, 15 May 2013 15:30:46 +0100
> Subject: [PATCH] kmemleak: Scan the jump label module section
>
> Objects allocated in jump_label_add_module() are currently reported as
> leaks, though the pointers are stored in the module jump label section.
> This patch informs kmemleak that this section needs to be scanned.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Reported-by: Steven Rostedt <rostedt@goodmis.org>

This didn't work. I still get the leak messages. But this change did:

Instead of just picking data sections by name (names that start
with .data, .bss or .ref.data), use the section flags and scan all
sections that are allocated, writable and not executable. Which should
cover all sections of a module that might reference data.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Index: linux-trace.git/kernel/module.c
===================================================================
--- linux-trace.git.orig/kernel/module.c
+++ linux-trace.git/kernel/module.c
@@ -2432,10 +2432,12 @@ static void kmemleak_load_module(const s

for (i = 1; i < info->hdr->e_shnum; i++) {
const char *name = info->secstrings + info->sechdrs[i].sh_name;
- if (!(info->sechdrs[i].sh_flags & SHF_ALLOC))
+
+ /* Scan all writable sections that's not executable */
+ if (!(info->sechdrs[i].sh_flags & SHF_ALLOC) ||
+ !(info->sechdrs[i].sh_flags & SHF_WRITE))
continue;
- if (!strstarts(name, ".data") && !strstarts(name, ".bss") &&
- !strstarts(name, ".ref.data"))
+ if (info->sechdrs[i].sh_flags & SHF_EXECINSTR)
continue;

kmemleak_scan_area((void *)info->sechdrs[i].sh_addr,



\
 
 \ /
  Last update: 2013-05-15 22:01    [W:0.172 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site