Re: çå: problem with kmemleak

From: ttlxzz ccc
Date: Thu May 12 2011 - 08:01:26 EST


Hi, Daniel:

I remove the module and didn't happen any exception. and U can see
that memory leak of insmod has been found int the kmemleak log. So I
think it doesn't happen in the rmmod.
Do you have other ideas, please?
thank you~~:)
On Thu, May 12, 2011 at 7:16 PM, Daniel Baluta <daniel.baluta@xxxxxxxxx> wrote:
> On Thu, May 12, 2011 at 12:59 PM, chenxi <chenxi05@xxxxxxxxx> wrote:
>> Thx, Maxin :)
>> ok
>> I did steps below:
>> 1 make oldconfig
>> 2 vim .config
>>  ...
>>  CONFIG_DEBUG_FS = y
>>  CONFIG_DEBUG_KMEMLEAK = y
>>  CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE = 1200
>>  ...
>> 3 make ; make modules ; and replace the kernel; reboot
>> 4 mount -t debugfs debugfs /sys/kernel/debug
>> 4 I wrote a module like this
>>  #include <linux/init.h>
>>  #include <linux/module.h>
>>  #include <linux/kernel.h>
>>  #include <linux/vmalloc.h>
>>
>> void myfunc(void)
>> {
>>        char *ptr;
>>        ptr = vmalloc(512);
>>        ptr = vmalloc(512);
>>        ptr = vmalloc(512);
>> }
>>
>> int hello_init(void)
>> {
>>        printk(KERN_ALERT "Hello World");
>>        myfunc();
>>        return 0;
>> }
>>
>> static void hello_exit(void)
>> {
>>        printk(KERN_ALERT "Goodbye World");
>> }
>>
>> module_init(hello_init);
>> module_exit(hello_exit);
>>
>> MODULE_LICENSE("GPL v2");
>>
>> 5 clear the kmemleak
>>  Echo clear > /sys/kernel/debug/kmemleak
>> 6 insmod the module
>>  Insmod xxx.ko
>
> Can you please remove your module?
> I think the memory is leaked at unload time.
>
> thanks,
> Daniel
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/