This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][GCC 5][PR sanitizer/69147] Fix ASan failures on new Darwin platforms (OS X 10.11+, iOS 9.0+).
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Maxim Ostapenko <m dot ostapenko at partner dot samsung dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Dominique Dhumieres <dominiq at lps dot ens dot fr>, Yury Gribov <y dot gribov at samsung dot com>
- Date: Wed, 13 Jan 2016 10:14:36 +0100
- Subject: Re: [PATCH][GCC 5][PR sanitizer/69147] Fix ASan failures on new Darwin platforms (OS X 10.11+, iOS 9.0+).
- Authentication-results: sourceware.org; auth=none
- References: <56961409 dot 1050506 at partner dot samsung dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Jan 13, 2016 at 12:08:25PM +0300, Maxim Ostapenko wrote:
> in OS X 10.11+ or iOS 9.0+, dyld will interpose even if
> DYLD_INSERT_LIBRARIES is not set. This means, that it's not safe to use
> "setenv" function to set DYLD_INSERT_LIBRARIES in MaybeReexec, because ASan
> interceptors already established and we can easily end up with something
> like this:
>
> AsanInitInternal -> MaybeReexec -> setenv -> some intercepted function (say,
> memmove) -> BOOM.
>
> In fact, there is no need to reexec at all on such platforms, because we
> already have working interceptors. Thus, for now we have completely broken
> ASan for OS X 10.11+ and iOS 9.0+ with GCC 5.
>
> Upstream ASan already has a fix for the issue, as well as GCC 6, so the
> proper solution would be just cherry-picking corresponding commits (r224315
> and r241487) from upstream to gcc-5-branch.
>
> Regtested and bootstrapped on x86_64-unknown-linux-gnu by myself and on
> x86_64-apple-darwin15.2.0 by Dominique
> (https://gcc.gnu.org/ml/gcc-testresults/2016-01/msg01115.html).
>
> Ok for gcc-5-branch?
Ok, thanks.
> libsanitizer/ChangeLog:
>
> 2016-01-13 Maxim Ostapenko <m.ostapenko@partner.samsung.com>
>
> * PR sanitizer/69147
> * asan/asan_mac.cc: Cherry pick upstream r241487.
> * sanitizer_common/sanitizer_mac.cc: Cherry pick upstream r224315.
> * sanitizer_common/sanitizer_mac.h: Likewise.
Jakub