This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Add early call handling to strchr + strrchr interceptors
ClosedPublic

Authored by bruening on Apr 27 2016, 11:41 AM.

Details

Summary

The strchr and strrchr interceptors are sometimes invoked too early for
their REAL() counterparts to be initialized. A special check is added to
use internal_ routines for this situation.

Diff Detail

Event Timeline

bruening updated this revision to Diff 55270.Apr 27 2016, 11:41 AM
bruening retitled this revision from to [sanitizer] Add early call handling to strchr + strrchr interceptors.
bruening updated this object.
bruening added a reviewer: vitalybuka.
bruening added subscribers: aizatsky, zhaoqin, kcc and 2 others.

Do these calls happen in libc? What's the reproducer? I wonder if there are any correctness implications because of this.

aizatsky accepted this revision.Apr 27 2016, 1:50 PM
aizatsky added a reviewer: aizatsky.
This revision is now accepted and ready to land.Apr 27 2016, 1:50 PM

Do these calls happen in libc? What's the reproducer? I wonder if there are any correctness implications because of this.

These are seen only with certain hooks invoked from tcmalloc on the dlsym() used in initializing interceptors. The other sanitizers all either use a custom allocator or avoid tcmalloc, while we'd prefer to leave the app heap layout as-is to better study its memory behavior, explaining why this was not seen before.

filcab accepted this revision.Apr 27 2016, 2:02 PM
filcab added a reviewer: filcab.
filcab added a subscriber: filcab.

Please add the information you gave in your answer to Mike to the commit message. Just a small example will do.
Something like:
"We have seen this in hooks invoked from tcmalloc on the dlsym() used in initializing interceptors" would be enough.

Thank you!

Please add the information you gave in your answer to Mike to the commit message. Just a small example will do.
Something like:
"We have seen this in hooks invoked from tcmalloc on the dlsym() used in initializing interceptors" would be enough.

Will do.

This revision was automatically updated to reflect the committed changes.