Date: Sun, 16 Jun 2013 15:41:44 -0400 From: Rich Felker <dalias@...ifal.cx> To: musl@...ts.openwall.com Subject: Re: valgrind problems On Sun, Jun 16, 2013 at 09:38:25PM +0200, Szabolcs Nagy wrote: > > I'm pretty sure valgrind's failure here is not missing the fact that > > brk (or any new anonymous pages) are zero pages; it's seeing the call > > to a function named "malloc" and treating the memory pointed to by the > > result as containing indeterminate values. If valgrind's logic were > > merely considering anonymous memory from brk or mmap as indeterminate, > > it could not catch errors due to use of indeterminate values in memory > > obtained by malloc that was recycled from an earlier call to free. > > the problem only shows up with static linking > where valgrind does not see the malloc call, > only brk > > valgrind thinks that brk is uninitialized > > it is easy to demonstrate even with glibc > (using static linking and valgind --track-origins=yes) > > so we should just let valgrind know that brk > is ok Oh, okay -- I misunderstood the problem then. And indeed the solution is just to tell valgrind that new memory from brk and anonymous mmap is zero-filled. I'm actually fairly surprised it doesn't already know that... Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.