Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Aug 2017 01:42:41 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 221337] -fsanitize=address (asan) fails on i386
Message-ID:  <bug-221337-8-uqDQMewTy9@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-221337-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-221337-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D221337

--- Comment #8 from Ed Maste <emaste@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 leas=
t,
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 =3D=
 0 and
*size =3D 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 fe=
tch
the extent of the current thread's stack and tls regions; ideally we can
replace this with a clean and consistent FreeBSD-specific interface.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-221337-8-uqDQMewTy9>