This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer_common] Fuchsia support for interceptors
ClosedPublic

Authored by mcgrathr on Jul 28 2017, 3:36 PM.

Details

Summary

Actually Fuchsia non-support for interceptors. Fuchsia doesn't use
interceptors in the common sense at all. Almost all system library
functions don't need interception at all, because the system
libraries are just themselves compiled with sanitizers enabled and
have specific hook interfaces where needed to inform the sanitizer
runtime about thread lifetimes and the like. For the few functions
that do get intercepted, they don't use a generic mechanism like
dlsym with RTLD_NEXT to find the underlying system library function.
Instead, they use specific extra symbol names published by the
system library (e.g. __unsanitized_memcpy).

Diff Detail

Repository
rL LLVM

Event Timeline

mcgrathr created this revision.Jul 28 2017, 3:36 PM
vitalybuka edited edge metadata.Jul 28 2017, 4:52 PM

Could you please split WINDOWS->POSIX and Fuchsia changes into different patches so that we land refactoring first.

lib/sanitizer_common/sanitizer_platform_interceptors.h
40 ↗(On Diff #108728)

Could you please add some sanity check like:
#if SI_POSIX == SI_WINDOWS
#error

78 ↗(On Diff #108728)

SHould this be

$if SANITIZER_POSIX && !SANITIZER_MAC

mcgrathr marked 2 inline comments as done.
mcgrathr added inline comments.
lib/sanitizer_common/sanitizer_platform_interceptors.h
40 ↗(On Diff #108728)

Done in D36038

78 ↗(On Diff #108728)

Done in D36038

mcgrathr updated this revision to Diff 108755.Jul 28 2017, 5:28 PM
mcgrathr marked 2 inline comments as done.

Rebased after D36038 split out

filcab accepted this revision.Jul 31 2017, 3:50 AM

LGTM. You might want to remove this from the commit message, though:

Fuchsia is neither Windows nor POSIX. The SI_NOT_WINDOWS macro in
sanitizer_platform_interceptors.h was already effectively the same
as SI_POSIX, so just use SI_POSIX instead.

Thank you,

Filipe

This revision is now accepted and ready to land.Jul 31 2017, 3:50 AM
mcgrathr updated this revision to Diff 109166.Aug 1 2017, 11:57 AM
mcgrathr edited the summary of this revision. (Show Details)

Rebased and ready to land.
Please land it for me!

Thanks,
Roland

This revision was automatically updated to reflect the committed changes.