From: Catalin Marinas <catalin.marinas@arm.com>
To: "tiejun.chen" <tiejun.chen@windriver.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] kmemleak/module: only scan the existed data section
Date: Tue, 10 Jan 2012 10:59:55 +0000 [thread overview]
Message-ID: <20120110105955.GK29581@arm.com> (raw)
In-Reply-To: <4F0BA99E.1090006@windriver.com>
On Tue, Jan 10, 2012 at 02:59:42AM +0000, tiejun.chen wrote:
> Catalin Marinas wrote:
> > I would rather move this check to kmemleak.c. But why would it be
> > needed? Performance? A zero-size area shouldn't be scanned anyway.
>
> When we call layout_sections() to calculate sh_entsize, often a zero-sized
> .data/.bss section would be ordered as a middle of all valid sections. For example,
> ------
> Symbol Addr size
>
> .init. 0xf96d3000
> ......
> .data(or .bss) 0xf96d3180 0
> ...... 0xf96d4000
>
> If so kmemleak_scan_area(0xf96d3180,0,GFP_KERNEL) is fine as we expect since
> 0xf96d3180 is always within a valid address scopes summarized all section,
> 0xf96d3000 ~ 0xf96d4000. But sometimes if that is arranged as a last section:
> -----
> Symbol Addr size
>
> .init. 0xf96d3000
> ......
> .data(or .bss) 0xf96d3180 0
>
>
> An then the following call trace is triggered
> ......
> kmemleak: Adding scan area to unknown object at 0xf96d3180
> Call Trace:
> [e9095de0] [c0008588] show_stack+0x68/0x1d8 (unreliable)
> [e9095e30] [c0690094] dump_stack+0x2c/0x44
> [e9095e40] [c015a190] kmemleak_scan_area+0x128/0x184
> [e9095e70] [c00a145c] load_module+0xa98/0x1c04
> [e9095f10] [c00a2650] sys_init_module+0x88/0x24c
> [e9095f40] [c0012f7c] ret_from_syscall+0x0/0x4
> --- Exception: c01 at 0xff63564
> LR = 0x10003414
Ah, good find. As I said, I would check the size in the
kmemleak_scan_area() function and ignore if 0 (same as the ptr check).
Thanks.
--
Catalin
prev parent reply other threads:[~2012-01-10 11:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-28 8:11 [PATCH 1/1] kmemleak/module: only scan the existed data section Tiejun Chen
2012-01-09 0:59 ` tiejun.chen
2012-01-09 12:05 ` Catalin Marinas
2012-01-10 2:59 ` tiejun.chen
2012-01-10 10:59 ` Catalin Marinas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120110105955.GK29581@arm.com \
--to=catalin.marinas@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tiejun.chen@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).