[PATCH] [Sanitizers] Order initialization of coverage and guard arrays

Viktor Kutuzov vkutuzov at accesssoftek.com
Sat Jan 10 01:26:34 PST 2015


> Could you please remind us why we can't guarantee this?


Well, we probably can, but it seems it's not implemented for all cases. :-)

The instrumentation part of coverage (Instrumentation/SanitizerCoverage.cpp) generates module-scope global objects and puts calls to ##__sanitizer_cov_module_init()## that is responsible for initializing module's guards to the ctors of these global objects. Similarly, ##__ubsan::InitIfNecessary()## that takes care of the initialization of coverage (lib/ubsan/ubsan_init.cc) is either part of the .preinit_array or called from the ctor of another global object (ubsan_initializer)--depending on whether the SANITIZER_CAN_USE_PREINIT_ARRAY macro is defined. In the latter case, since these objects belong to different modules, they can generally be initialized in any order.

> (Better yet, add a test)


Umm, I guess for this we would need to replace the ..._PREINIT_ARRAY macro with a run-time flag that controls the way the initialization is performed. Do we really want this?


http://reviews.llvm.org/D6892

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list