Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Feb 2014 11:06:48 +0000 (UTC)
From:      David Xu <davidxu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r262334 - head/libexec/rtld-elf
Message-ID:  <201402221106.s1MB6mSe005349@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402221106.s1MB6mSe005349>