Page MenuHomePhabricator

[sanitizer] Fix strlen assumptions in sanitizer interception code
Needs ReviewPublic

Authored by bruening on Mar 4 2016, 8:47 AM.



Switches the shared sanitizer interception code to use internal_strlen
rather than REAL(strlen), as the latter implicitly assumes that the
including sanitizer has supplied its own strlen interceptor prior to
including the common file.

Diff Detail

Event Timeline

bruening updated this revision to Diff 49833.Mar 4 2016, 8:47 AM
bruening retitled this revision from to [sanitizer] Fix strlen assumptions in sanitizer interception code.
bruening updated this object.
bruening added a reviewer: eugenis.
bruening added subscribers: kcc, llvm-commits.

I think it's reasonable to make an assumption that we're intercepting strlen(), and the REAL() version works faster. Depending on the order of inclusion is not nice, for sure.

Can you use DECLARE_REAL(SIZE_T, strlen, const char *s); in the .inc file instead?

What if instead we moved the strlen interceptors that are currently private to asan, tsan, and msan into the set of common interceptors, thus ensuring that REAL(strlen) exists (as well as unifying the currently duplicate interceptors)? I actually already have a local CL that moves strlen and strchr* into the common set which I can send for review.

Yes, this would definitely be a better solution.