Groups > Unix Linux > Linux general discussion > Memory Corruption: stack and heap overlap




Memory Corruption: stack and heap overlap

Memory Corruption: stack and heap overlap
Thu, 06 Dec 2007 07:52:21 -080
I am running  SUSE Enterprise Server 9, Kernel 2.6.5, 32-bit. 

Our application sometimes pushes memory consumption to the
limits. We all the memory we can get. Under these conditions we get
strange instances of memory corruption. In all these cases, we had
stack expanding over the end of the heap.

I though this kind of thing would not be allowed. Does the OS not take
care of this?

I created a small reproducer for this scenario. To my great
surprise,  I discovered that  this is entirely possible. 

Are we supposed to protect ourselves internally from this happening?

By watching the ends of stack and the heap as the application runs, or
something?

Or is it just a bug in the kernel, and this should not be happening?

Thank you,
Post Reply
about | contact