|
From: Nicholas N. <n.n...@gm...> - 2009-05-07 22:56:13
|
On Fri, May 8, 2009 at 6:34 AM, Karlan Mitchell <kar...@gm...> wrote: > > So, that being said I would like to write a patch, for my own use at first, > which writes > random bits to all memory being initialized (optionally of course). The > problem is > I don't know where would be the best place to do this? I have absolutely no > clue how > valgrind implements memory management however I'm assuming I'd only need to > add this > in two places, the malloc code, and the allocation code for ".text". For Memcheck, the functionality is already there for heap (malloc) blocks: use the --malloc-fill and --free-fill options. As for "the allocation code for .text", static and mmap'd memory is intialised to zero, so you can't fill that with your own values. The only other sources of uninitialised memory are brk() and stack allocations. Filling in your own values would be possible but would require modifying Valgrind. Search for VG_(track_new_mem_brk) and VG_(track_new_mem_stack*) if you want to do this. Nick |