svn commit: r262334 - head/libexec/rtld-elf
David Xu
davidxu at FreeBSD.org
Sat Feb 22 11:06:49 UTC 2014
Author: davidxu
Date: Sat Feb 22 11:06:48 2014
New Revision: 262334
URL: http://svnweb.freebsd.org/changeset/base/262334
Log:
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.
Modified:
head/libexec/rtld-elf/xmalloc.c
Modified: head/libexec/rtld-elf/xmalloc.c
==============================================================================
--- head/libexec/rtld-elf/xmalloc.c Sat Feb 22 10:15:27 2014 (r262333)
+++ head/libexec/rtld-elf/xmalloc.c Sat Feb 22 11:06:48 2014 (r262334)
@@ -73,10 +73,8 @@ malloc_aligned(size_t size, size_t align
{
void *mem, *res;
- if (align & (sizeof(void *) -1)) {
- rtld_fdputstr(STDERR_FILENO, "Invalid alignment\n");
- _exit(1);
- }
+ if (align < sizeof(void *))
+ align = sizeof(void *);
mem = xmalloc(size + sizeof(void *) + align - 1);
res = (void *)round((uintptr_t)mem + sizeof(void *), align);
More information about the svn-src-head
mailing list