From: chrislaberti@gmail.com (Chris Laberti)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Module to sanitize freed memory ?
Date: Fri, 13 May 2011 14:05:40 +0200 [thread overview]
Message-ID: <BANLkTi=ECZtGDf2a_yHuZ451eM8EQMCqtw@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1105121123270.10613@localhost6.localdomain6>
>> 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
prev parent reply other threads:[~2011-05-13 12:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='BANLkTi=ECZtGDf2a_yHuZ451eM8EQMCqtw@mail.gmail.com' \
--to=chrislaberti@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).