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

Alexander Potapenko glider at google.com
Thu Jan 29 08:44:14 PST 2015


Nope, Mach-O doesn't support constructor priorities.

On Wed, Jan 28, 2015 at 3:06 PM, Alexey Samsonov <vonosmas at gmail.com> wrote:
>
> On Wed, Jan 28, 2015 at 8:15 AM, Viktor Kutuzov <vkutuzov at accesssoftek.com>
> wrote:
>>
>> OK, it makes sense, thanks. However, while it works for Asan's
>> ##__asan_init()t## called from the code injected by the instrumentation
>> part, it doesn't work for UBsan where, in omission of
>> SANITIZER_CAN_USE_PREINIT_ARRAY, ##__ubsan::InitIfNecessary()## is called
>> from a regular constructor which has a lower priority than
>> ##__sanitizer_cov_module_init##. Maybe we should introduce instrumentation
>> for UBsan or just replace the ##ubsan_initializer## declaration:
>>
>>   class UbsanInitializer {
>>    public:
>>     UbsanInitializer() {
>>       InitIfNecessary();
>>     }
>>   };
>>   static UbsanInitializer ubsan_initializer;
>>
>> with something like:
>>
>>   __attribute__((constructor(1)))
>>   void __init_ubsan() {
>>     InitIfNecessary();
>>   }
>
>
> +glider
>
> Do constructors with different priority work on Mac? IIRC they don't (and we
> had to disable init-order checker on Mac because of that). Sadly, Mac also
> has SANITIZER_CAN_USE_PREINIT_ARRAY=0.
>
>>
>>
>>
>> REPOSITORY
>>   rL LLVM
>>
>> http://reviews.llvm.org/D6892
>>
>> EMAIL PREFERENCES
>>   http://reviews.llvm.org/settings/panel/emailpreferences/
>>
>>
>
>
>
> --
> Alexey Samsonov
> vonosmas at gmail.com



-- 
Alexander Potapenko
Software Engineer
Google Moscow



More information about the llvm-commits mailing list