Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Oct 2017 21:31:04 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r324938 - head/contrib/jemalloc/include/jemalloc/internal
Message-ID:  <201710232131.v9NLV4Rb068825@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Mon Oct 23 21:31:04 2017
New Revision: 324938
URL: https://svnweb.freebsd.org/changeset/base/324938

Log:
  After jemalloc was updated to version 5.0.0 in r319971, i386 executables
  linked with AddressSanitizer (even those linked on earlier versions of
  FreeBSD, or with external versions of clang) started failing with errors
  similar to:
  
    ==14688==AddressSanitizer CHECK failed:
    /usr/src/contrib/compiler-rt/lib/asan/asan_poisoning.cc:36
    "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)
  
  This is because AddressSanitizer expects all the TLS data in the program
  to be aligned to at least 8 bytes.
  
  Before the jemalloc 5.0.0 update, all the TLS data in the i386 version
  of libc.so added up to 80 bytes (a multiple of 8), but 5.0.0 made this
  grow to 2404 bytes (not a multiple of 8).  This is due to added caching
  data in jemalloc's internal struct tsd_s.
  
  To fix AddressSanitizer, ensure this struct is aligned to at least 16
  bytes, which can be done unconditionally for all architectures.  (An
  earlier version of the fix aligned the struct to 8 bytes, but only for
  ILP32 architectures.  This was deemed unnecessarily complicated.)
  
  PR:		221337
  X-MFC-With:	r319971

Modified:
  head/contrib/jemalloc/include/jemalloc/internal/tsd.h

Modified: head/contrib/jemalloc/include/jemalloc/internal/tsd.h
==============================================================================
--- head/contrib/jemalloc/include/jemalloc/internal/tsd.h	Mon Oct 23 20:50:08 2017	(r324937)
+++ head/contrib/jemalloc/include/jemalloc/internal/tsd.h	Mon Oct 23 21:31:04 2017	(r324938)
@@ -120,7 +120,8 @@ struct tsd_s {
 	t use_a_getter_or_setter_instead_##n;
 MALLOC_TSD
 #undef O
-};
+/* AddressSanitizer requires TLS data to be aligned to at least 8 bytes. */
+} JEMALLOC_ALIGNED(16);
 
 /*
  * Wrapper around tsd_t that makes it possible to avoid implicit conversion



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