Module to sanitize freed memory ?
Hi, Is there a kernel module that sanitizes (overwrites) freed memory ? Or maybe does sysctl offer something like this ? Regards, Chris
On Thu, May 12, 2011 at 05:12:19PM +0200, Chris Laberti wrote:
Hi,
Is there a kernel module that sanitizes (overwrites) freed memory ? Or maybe does sysctl offer something like this ?
What's wrong with the kernel option that does this for you (CONFIG_DEBUG_SLAB)? No need to write a separate kernel module at all. greg k-h
On Thu, 12 May 2011, Chris Laberti wrote:
Hi,
Is there a kernel module that sanitizes (overwrites) freed memory ? Or maybe does sysctl offer something like this ?
you can always use the kzfree() routine, that zeroes freed memory automatically. rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ========================================================================
Hi,
Is there a kernel module that sanitizes (overwrites) freed memory ? Or maybe does sysctl offer something like this ?
Regards, Chris
you can always use the kzfree() routine, that zeroes freed memory automatically.
rday
What's wrong with the kernel option that does this for you (CONFIG_DEBUG_SLAB)? No need to write a separate kernel module at all.
greg k-h
Hi, Thank you for both answers. I have enabled CONFIG_DEBUG_SLAB and modified the memset() in kzfree() to -1 instead of 0 but memory is zeroed rather than filled with -1. I have looked over the code but cannot find what is zeroing the memory. I want to use -1 so that debugging C code is easier because if the memory is filled with zeroes (nul chars), then buffer overflows will be hidden, making it difficult to debug. Does anybody know what code to modify in order to fill with -1 instead of zero ? Regards, Chris
participants (3)
-
Chris Laberti -
Greg KH -
Robert P. J. Day