]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r262277:
authordavidxu <davidxu@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 27 Feb 2014 02:36:09 +0000 (02:36 +0000)
committerdavidxu <davidxu@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 27 Feb 2014 02:36:09 +0000 (02:36 +0000)
commit27289d528db292b702da6641f8bd2484e9efa0f5
tree27c811097b1e1ebd1b76dac8f1a7de7be6e7aa26
parentbf8a6441cb244603e6430b9f8e3791d3e67133d2
MFC r262277:

malloc_aligned() may not leave enough space for pointer to allocated memory,
saving the pointer will overwrite bytes belongs to another memory block
unexpectly, to fix the problem, use (allocated address + sizeof(void *)) as
initial value, and slip to next aligned address, so maximum extra bytes is
sizeof(void *) + align - 1.

Tested by: Andre Albsmeier < mail at ma17 dot ata dot myota dot orgndre >

MFC r262334:

Increase alignment to size of pointer if the alignment is too small.
Some modules do not align data at least to size of pointer, they uses a
smaller alignment, but our pointer should be aligned to its native
boundary, otherwise on some platforms, hardware alignment checking
will cause bus error.

git-svn-id: svn://svn.freebsd.org/base/stable/10@262544 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
libexec/rtld-elf/xmalloc.c