Debugging memory allocation crash

Mulyadi Santosa mulyadi.santosa at gmail.com
Thu Dec 29 06:40:14 EST 2011


Hi.....

Nice name you have :)

On Thu, Dec 29, 2011 at 11:27, contemplating zombie
<contemplatingzombie at gmail.com> wrote:
> Hi,
>
> I have written a kernel module that does frequent memory allocs,
> reallocs and deallocs. The code randomly crashes at one of the two
> memory allocation parts - either in krealloc() or in
> kmem_cache_alloc_notrace (called by kmalloc()). However, when I
> analyzed both the crash points instructions using gdb, they both
> turned out to be at the same location in slab_alloc().

alright, all we know is that  kmalloc and family eventually use slabs.

So, I suspect:
1. either there are flaws in slab management
OR
2. you somehow corrupt the slab

Since you don't let us see the code, I'll ask you back:
1. do you think somehow you feed data bigger than one allocated?
2. do you somehow do double free?
3. regarding realloc...I personally don't really think it's better
than alloc-free-alloc cycle. So, have you tried to convery your
realloc call into alloc-free-alloc?

About the GPF, i just sense it might be a terrible memory corrupt
somewhere somehow, And usually, the root is overflow...

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com



More information about the Kernelnewbies mailing list