public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jianpeng Ma" <majianpeng@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: About reuse address space when __init func removed
Date: Mon, 15 Oct 2012 16:52:51 +0800	[thread overview]
Message-ID: <201210151652486099657@gmail.com> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 2241 bytes --]

Hi all,
	Today, I found some kernel message about memeleaking.As follows:
unreferenced object 0xffff8800b6e6b980 (size 64):
  comm "modprobe", pid 1137, jiffies 4294676166 (age 7326.499s)
  hex dump (first 32 bytes):
    01 04 01 00 00 00 00 00 00 00 98 b5 00 88 ff ff  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff816a3f16>] kmemleak_alloc+0x56/0xc0
    [<ffffffff8113bd43>] __kmalloc+0x173/0x310
    [<ffffffffa009a78a>] 0xffffffffa009a78a
    [<ffffffffa009ad95>] 0xffffffffa009ad95
    [<ffffffff81300985>] pci_device_probe+0x75/0xa0
    [<ffffffff814078c4>] driver_probe_device+0x84/0x380
    [<ffffffff81407c63>] __driver_attach+0xa3/0xb0
    [<ffffffff81405a96>] bus_for_each_dev+0x56/0x90
    [<ffffffff81407359>] driver_attach+0x19/0x20
    [<ffffffff81406e80>] bus_add_driver+0x1a0/0x2c0
    [<ffffffff81408195>] driver_register+0x75/0x150
    [<ffffffff812ffa1c>] __pci_register_driver+0x5c/0x70
    [<ffffffffa00a20a7>] nfsd_last_thread+0x47/0x70 [nfsd]
    [<ffffffff810001fa>] do_one_initcall+0x3a/0x170
    [<ffffffff810a7d1c>] sys_init_module+0x8c/0x200
    [<ffffffff816cc352>] system_call_fastpath+0x16/0x1b

But the problem is not memleak, but the stack.
I noticed "[<ffffffffa00a20a7>] nfsd_last_thread+0x47/0x70 [nfsd]".But the real module is mvsas.
Why the kernel print nfsd?

I added some debuginfo in func mvs_init.
diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
index cc59dff..d34ce01 100644
--- a/drivers/scsi/mvsas/mv_init.c
+++ b/drivers/scsi/mvsas/mv_init.c
@@ -821,6 +821,7 @@ static int __init mvs_init(void)
 {
        int rc;
        mvs_stt = sas_domain_attach_transport(&mvs_transport_ops);
+       printk(KERN_ERR"%s:0x%lx\n", __func__, _THIS_IP_);
        if (!mvs_stt)
                return -ENOMEM;

The result is "[    3.781487] mvs_init:0xffffffffa00a2000"

I think because the __init attribute.When mvs_init execd,those memeory removed and the address space alse removed.So after func nfsd_last_thread used those address.
Is it a bug?

Thanks!ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

                 reply	other threads:[~2012-10-15  8:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=201210151652486099657@gmail.com \
    --to=majianpeng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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