Hi all:
I am using linux-3.14 on Android device, want to use kmemcheck.
I write a sample test module, it seems the kmemcheck and slub_debug cannot detect it, any suggestion?
CONFIG_SLUB_DEBUG=y
# CONFIG_COMPAT_BRK is not set
# CONFIG_SLAB is not set
CONFIG_SLUB=y
CONFIG_SLUB_CPU_PARTIAL=y
CONFIG_HAVE_ARCH_KMEMCHECK=y
CONFIG_KMEMCHECK=y
# CONFIG_KMEMCHECK_DISABLED_BY_DEFAULT is not set
CONFIG_KMEMCHECK_ENABLED_BY_DEFAULT=y
# CONFIG_KMEMCHECK_ONESHOT_BY_DEFAULT is not set
CONFIG_KMEMCHECK_QUEUE_SIZE=64
CONFIG_KMEMCHECK_SHADOW_COPY_SHIFT=5
CONFIG_KMEMCHECK_PARTIAL_OK=y
Best,
tianfei
static int kmem_free_test(void)
{
char *buf = kmalloc(100, GFP_KERNEL);
if (buf) {
kfree(buf);
*buf = 200;
*(buf+10) = ‘a’;
*(buf +105) = 200;
printk("you hit a random char\n");
}
return 0;
}
static int __init kmem_test_init(void)
{
kmem_free_test();
return 0;
}
static void __exit kmem_test_exit(void)
{
}
module_exit(kmem_test_exit);
module_init(kmem_test_init);