memory pages nulling when releasing

Dan Lukes dan at obluda.cz
Tue Jun 20 15:05:54 UTC 2006


Nick Withers napsal/wrote, On 06/20/06 04:53:
>> 	To Nick: OS doesn't zero on free.
> 
> FreeBSD does*, if the "J" flag is set in _malloc_options /

	You speak what the libc does, not about OS itself. I can wrote program 
using brk/sbrk (another libc functions) to manage it's memory. It set 
the "end margin" of program's data segment. I think it doesn't zero the 
end of data segment before shrinking. But I need no libc to wrote a 
program at all ...

	Well, if we want to speak about OS memory management we need to clarify 
what the memory we speak of and what exactly we thing saying "free of a 
memory".

> * Alright, it doesn't zero, as such, but will (again, unless
> I've misunderstood the malloc(3) man page) initialise each byte
> to 0xd0

2006/6/20, Nick Withers <nick at nickwithers.com>:

 > There's "Z" malloc option that's used to initialise page with zeros
 > instead of 0xd0

	Difference betwen Z and J isn't the fill value only. Z apply for 
allocations of new memory (when imalloc() called); J apply on changes in 
allocated block size (e.g. realloc) and free. So 'Z' doesn't "zero on 
free" but "zero on alloc". Well, things aren't simple as Z implies J ...

	BTW, Z nor J doesn't imply 'R' despite of text of manual page.


  					Dan


-- 
Dan Lukes                                   SISAL MFF UK
AKA: dan at obluda.cz, dan at freebsd.cz,dan at kolej.mff.cuni.cz


More information about the freebsd-security mailing list