Re: Malloc -Z
- From: Sean <sean@xxxxxxxxxxxxx>
- Date: Wed, 27 Jul 2011 22:44:45 +1000
On 27/07/2011, at 4:49 PM, 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?
If so, it seems running with -Z would be prudent if one cares.
Therefore, what is the rough percent performance
impact of -Z compared to default malloc?
malloc(3) has never provided zeroed memory. If you need zeroed memory in C, you either need to zero it yourself using memset(3), or use calloc(3).
It's been part of the language standard for over 20 years now, and is the same in that regard on every platform that provides malloc(3).
What would be prudent as a developer (and is the default in CURRENT I believe) is to use J - it enforces the "memory from malloc(3) is not guaranteed to be zeroed." by specifically setting it to non-zero.
Bonus:
What would be needed to make the useful streams:
/dev/one
/dev/10
/dev/01
In addition to /dev/zero.
_______________________________________________
freebsd-security@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-security
To unsubscribe, send any mail to "freebsd-security-unsubscribe@xxxxxxxxxxx"
_______________________________________________
freebsd-security@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-security
To unsubscribe, send any mail to "freebsd-security-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: Malloc -Z
- From: grarpamp
- Re: Malloc -Z
- From: Poul-Henning Kamp
- Re: Malloc -Z
- References:
- Malloc -Z
- From: grarpamp
- Malloc -Z
- Prev by Date: Malloc -Z
- Next by Date: Re: Malloc -Z
- Previous by thread: Malloc -Z
- Next by thread: Re: Malloc -Z
- Index(es):
Relevant Pages
|