[PATCH] Fix PR55521 by switching libsanitizer from mach_override to mac interpose functions on darwin

Alexander Potapenko glider@google.com
Sun Dec 2 18:45:00 GMT 2012


On Sun, Dec 2, 2012 at 10:15 PM, Jack Howarth <howarth@bromo.med.uc.edu> wrote:
> On Sun, Dec 02, 2012 at 10:21:02AM +0400, Alexander Potapenko wrote:
>> Hi Jack,
>>
>> IIUC the wrappers for dispatch_async_f, dispatch_sync_f and other
>> dispatch_smth_f do not need blocks support in the compiler, since
>> regular functions are passed into them. So you may want to add the
>> dynamic interceptors for those back.
>
> Alex,
>   This seems to only require the readjustment of the preprocessor
> statements in libsanitizer/asan/dynamic/asan_interceptors_dynamic.cc.
> I'll post the revised patch as soon as regression testing is finished.
>
>> The remaining problem is that dispach_async and other functions using
>> blocks won't be intercepted. This may lead to assertion failures in
>> big projects (e.g. we needed those for Chrome).
>
> In theory that is a problem, however my understanding was that the asan
> dispatch support was added for use by objc/obj-c++ code. The objc/obj-c++
> in FSF gcc is very fragile, on later darwin, since it runs against the
> system Objective-C runtime but the compiler is only based on a merge
> of the remaining bits of code from the old FSF gcc Apple branch circa
> 2006. IMHO, it is insane to try to do any production work with our
> objc/obj-c++ compiler and current Mac OS X releases.
Ok, this makes sense.
>> Overall, the change looks good. Do you want me to backport
>> MISSING_BLOCKS_SUPPORT into the LLVM version of the runtime?
>
> Yes, as it should be transparent to llvm's builds.
I'll do that tomorrow morning then.
>>
>> Alex
>>
>> On Sun, Dec 2, 2012 at 6:43 AM, Jack Howarth <howarth@bromo.med.uc.edu> wrote:
>> >    The attached patch eliminates PR 55521/sanitizer by switching libasan on darwin
>> > from using mach_override to mac function interposition via the importation of the
>> > asan/dynamic/asan_interceptors_dynamic.cc file from llvm.org's compiler-rt svn.
>> > The changes involve defining USING_MAC_INTERPOSE in configure.ac rather than
>> > rather than USING_MACH_OVERRIDE, introduction of the use of USING_MAC_INTERPOSE
>> > in Makefile.am to avoid building the interception subdirectory, the passage of
>> > -DMAC_INTERPOSE_FUNCTIONS in asan/Makefile.am when USING_MAC_INTERPOSE as well as
>> > the introduction of a -DMISSING_BLOCKS_SUPPORT flag to disable code that requires
>> > blocks support which FSF gcc lacks. The depreciated usage of USING_MACH_OVERRIDE
>> > is also removed from interception/Makefile.am. Bootstrapped on x86_64-apple-darwin10,
>> > x86_64-apple-darwin11 and x86_64-apple-darwin12. Passes...
>> >
>> > make -k check RUNTESTFLAGS="asan.exp --target_board=unix'{-m32,-m64}'"
>> >
>> > and fixes the previously failing cond1.C test case from PR55521 on all three targets.
>> > Okay for gcc trunk?
>> >               Jack
>> >
>>
>>
>>
>> --
>> Alexander Potapenko
>> Software Engineer
>> Google Moscow



--
Alexander Potapenko
Software Engineer
Google Moscow



More information about the Gcc-patches mailing list