Malloc -Z

RW rwmaillists at googlemail.com
Wed Jul 27 18:19:20 UTC 2011


On Wed, 27 Jul 2011 02:49:48 -0400
grarpamp wrote:

> Was reading malloc(3) while chasing corruption suspects.
> Does the presence of -Z imply that without it, programs
> can be allocated dirty (non-zeroed) memory?

Programs (in the sense of processes) are allocated zeroed-memory.

Memory allocated by malloc will either be zeroed or contain pages
written to by the same process. 

In general any security concerns about sensitive data should be handled
by zeroing before freeing (or when the data is no longer needed) rather
than zeroing on allocation.


More information about the freebsd-security mailing list