patch: link ubsan into shared libraries

Kostya Serebryany kcc at google.com
Tue Aug 13 01:06:58 PDT 2013


LGTM
ubsan is indeed different from asan/tsan/msan/dfsan as it has no state.


On Tue, Aug 13, 2013 at 4:23 AM, Nick Lewycky <nlewycky at google.com> wrote:

> On 12 August 2013 16:36, Richard Smith <richard at metafoo.co.uk> wrote:
>
>> LGTM, thanks!
>>
>
> Thanks! I'd like to give the other sanitizer folks a chance to complain,
> so I'm going to wait until tomorrow before committing it.
>
> On Mon, Aug 12, 2013 at 4:25 PM, Nick Lewycky <nlewycky at google.com> wrote:
>>
>>> The attached patch causes ubsan to get linked in when building a .so
>>> file. This is different from other sanitizers.
>>>
>>> The other sanitizers are harder to deploy because they rely on replacing
>>> malloc. This means that you have to figure out how to link in a single
>>> malloc in the final binary.
>>>
>>> ubsan doesn't need this. You could link a .so file with ubsan, then link
>>> the final binary with no knowledge that ubsan was ever involved, and it
>>> will work just fine. (Or rather, it will after this patch.) In particular,
>>> I can't currently build a python module with ubsan and then load it into a
>>> normal python. The attached patch makes this work.
>>>
>>> The downside to this patch is that we can end up with multiple copies of
>>> the ubsan runtime linked in. In reality this works fine because the ubsan
>>> runtime doesn't keep much state (and it'd be difficult to make it do so
>>> correctly because it has to support calling through files that are a mix of
>>> built and not build with ubsan). We'll end up with multiple copies of
>>> ubsan's vptr cache, which in turn will probably improve performance by
>>> improving locality.
>>>
>>> Please review!
>>>
>>> Nick
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>
>>>
>>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130813/cc401aa7/attachment.html>


More information about the cfe-commits mailing list