Re: çå: problem with kmemleak

From: Daniel Baluta
Date: Thu May 12 2011 - 07:16:37 EST


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/