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

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

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

Thread sanitizer algorithm description at
https://github.com/google/sanitizers/wiki/ThreadSanitizerAlgorithm

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
tried:

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.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to