I enabled the advanced use-after-free detector for large slab objects and the
kernel oopsed. This is because that debug code adds things at the head of
the slab objects, and the kernel will die if task_structs are not
well-aligned.
The way to tell the slab allocator that it is not allowed to misalign objects
from this slab is SLAB_MUST_HWCACHE_ALIGN.
task_struct_cachep =
kmem_cache_create("task_struct",
sizeof(struct task_struct),0,
- SLAB_HWCACHE_ALIGN, NULL, NULL);
+ SLAB_MUST_HWCACHE_ALIGN, NULL, NULL);
if (!task_struct_cachep)
panic("fork_init(): cannot create task_struct SLAB cache");