This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Overhaul malloc related interceptors
ClosedPublic

Authored by cryptoad on Jan 25 2018, 9:15 AM.

Details

Summary

This is a follow-up to D42506.

There are a few of things that bothered me about scudo_interceptors.cpp:

  • the filename is a misnomer: it intercepts some functions, but the rest (C++) is actually in scudo_new_delete.cpp. I feel like scudo_malloc.cpp is more appropriate (ASan uses the same naming scheme);
  • we do not need "full" interceptors, since we are never accessing the unsanitized version of the functions, we just need the extern "C" INTERCEPTOR_ATTRIBUTE part of it to just call our functions;
  • a couple of functions where duplicated while they could just be ALIAS'd;
  • use the SANITIZER_INTERCEPT_* defines to hide the unneeded interceptors;
  • use SIZE_T instead of uptr: while it's the same behind the curtain, the former is meant for this use case.

In the end there is no functional change on the currently supported platforms
(Linux, Android).

Diff Detail

Event Timeline

cryptoad created this revision.Jan 25 2018, 9:15 AM
Herald added subscribers: Restricted Project, delcypher, hintonda, mgorny. · View Herald TranscriptJan 25 2018, 9:15 AM
alekseyshl accepted this revision.Jan 25 2018, 11:28 AM
This revision is now accepted and ready to land.Jan 25 2018, 11:28 AM
This revision was automatically updated to reflect the committed changes.
lib/scudo/CMakeLists.txt