[Bug 221337] -fsanitize=address (asan) fails on i386

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Aug 16 17:47:02 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221337

--- Comment #7 from Dimitry Andric <dim at FreeBSD.org> ---
(In reply to Konstantin Belousov from comment #6)
> (In reply to Dimitry Andric from comment #5)
> Still the question is up.  Why this code wants 8-byte alignment of the TLS
> segment for module with index 1 ?
> 
> What would not work otherwise ?

Ah sorry, that is the way upstream compiler-rt has apparently hardcoded it,
e.g. they use a define SHADOW_GRANULARITY for this, here:

https://github.com/llvm-mirror/compiler-rt/blob/master/lib/asan/asan_mapping.h#L193

   127  static const u64 kDefaultShadowScale = 3;
...
   145  #define SHADOW_SCALE kDefaultShadowScale
...
   193  #define SHADOW_GRANULARITY (1ULL << SHADOW_SCALE)

The same granularity scale values is found in the llvm instrumentation
libraries, here:
https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/Instrumentation/AddressSanitizer.cpp#L70

    70  static const uint64_t kDefaultShadowScale = 3;

In the past I have attempted to lower this scale to 2, but ran into hundreds of
test failures, so I abandoned that effort.  I think the assumption is working
without issue for e.g. Linux, since they left the SysV ABI a long time ago
there.  And apparently we have been lucky somehow, all this time; it has worked
well since the first time we tried AddressSanitizer, up to 12.0 before jemalloc
5.0.0.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list