Re: Malloc -Z

看板FB_security作者時間14年前 (2011/07/27 21:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/9 (看更多)
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? >=20 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@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-security > To unsubscribe, send any mail to = "freebsd-security-unsubscribe@freebsd.org" _______________________________________________ freebsd-security@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-security To unsubscribe, send any mail to "freebsd-security-unsubscribe@freebsd.org"
文章代碼(AID): #1EC1DKmp (FB_security)
文章代碼(AID): #1EC1DKmp (FB_security)