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

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Aug 18 01:42:41 UTC 2017


--- Comment #8 from Ed Maste <emaste at freebsd.org> ---
Some possibly useful references:

This (GetThreadStackAndTls) originally arrived in
https://reviews.llvm.org/rL156542. FreeBSD support was added in

Thread sanitizer algorithm description at

I think the use of dtv[2] is indeed strange - AFAICT the intent is that it
should be returning the address and size of the entire TLS block -- at least,
the contiguous block of "initially available modules."

I suppose there are a few fairly straightforward changes/hacks that could be

1. Change the FreeBSD GetTls in sanitizer_linux_libcdep.cc to set *addr = 0 and
*size = 0. My guess is that this will just exclude all tls accesses from the
sanitizer. If that works I'd be happy enough with it as an initial stopgap on
FreeBSD/i386 (asan that does not detect errors with tls is better than asan
that does not work at all).
2. Make TLS_TCB_ALIGN 8 for i386 in libc tls.c
3. Round addr down to be 8-byte aligned (increasing size as necessary)

All of this goop is to implement a function void GetThreadStackAndTls(bool
main, uptr *stk_addr, uptr *stk_size, uptr *tls_addr, uptr *tls_size) to fetch
the extent of the current thread's stack and tls regions; ideally we can
replace this with a clean and consistent FreeBSD-specific interface.

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

More information about the freebsd-bugs mailing list