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

Alexey Samsonov vonosmas at gmail.com
Wed Jan 28 15:06:24 PST 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150128/5d076a9b/attachment.html>


More information about the llvm-commits mailing list