On Wed, Nov 08, 2017 at 08:43:43AM +0100, Jakub Jelinek wrote:
> Hi!
> 
> The upstream libubsan in the name of behaving more similarly between
> all the other sanitizers turned the library from a lightweight set of a few
> helper routines that print errors if something goes wrong into yet another
> library that overrides various functions.
> 
> In particular, it now overrides signal and sigaction functions and therefore
> requires to be initialized before anything else (otherwise, if somebody
> calls signal or sigaction before the library is fully initialized, it just
> crashes).  But this overriding isn't really needed for what the library is
> doing, just so that there is some pretty printing of fatal signals.
> 
> I really don't like that, IMHO libubsan has no business in doing that, so
> instead of adding .preinit_array initializers for the library, this patch
> just removes that useless initialization and overriding from the library.
> If people really need the pretty printing, they can use -fsanitize=address,
> or leak or thread which all do need the heavy early initialization.
> 
> With this change, the ubsan initialization is performed on the first call
> that actually wants to print something (and the initialization is only the
> minimal set of stuff, parsing env vars, handling suppressions etc.).

I agree, I think this lazy initialization is much better.

        Marek

Reply via email to