kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Module to sanitize freed memory ?
       [not found] <BANLkTimynqn2vT8S6yRxhSxhUioC9_AXoQ@mail.gmail.com>
@ 2011-05-12 15:12 ` Chris Laberti
  2011-05-12 15:20   ` Greg KH
  2011-05-12 15:23   ` Robert P. J. Day
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Laberti @ 2011-05-12 15:12 UTC (permalink / raw)
  To: kernelnewbies

Hi,

Is there a kernel module that sanitizes (overwrites) freed memory ? Or
maybe does sysctl offer something like this ?

Regards,
Chris

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Module to sanitize freed memory ?
  2011-05-12 15:12 ` Module to sanitize freed memory ? Chris Laberti
@ 2011-05-12 15:20   ` Greg KH
  2011-05-12 15:23   ` Robert P. J. Day
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2011-05-12 15:20 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Module to sanitize freed memory ?
  2011-05-12 15:12 ` Module to sanitize freed memory ? Chris Laberti
  2011-05-12 15:20   ` Greg KH
@ 2011-05-12 15:23   ` Robert P. J. Day
  2011-05-13 12:05     ` Chris Laberti
  1 sibling, 1 reply; 4+ messages in thread
From: Robert P. J. Day @ 2011-05-12 15:23 UTC (permalink / raw)
  To: kernelnewbies

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
========================================================================

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Module to sanitize freed memory ?
  2011-05-12 15:23   ` Robert P. J. Day
@ 2011-05-13 12:05     ` Chris Laberti
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Laberti @ 2011-05-13 12:05 UTC (permalink / raw)
  To: kernelnewbies

>> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-13 12:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <BANLkTimynqn2vT8S6yRxhSxhUioC9_AXoQ@mail.gmail.com>
2011-05-12 15:12 ` Module to sanitize freed memory ? Chris Laberti
2011-05-12 15:20   ` Greg KH
2011-05-12 15:23   ` Robert P. J. Day
2011-05-13 12:05     ` Chris Laberti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).