Subject: Re: [boost] [thread] Address sanitizer failures on marshall-mac
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-03-07 15:55:04


On Fri, Mar 7, 2014 at 10:35 PM, Niall Douglas
<s_sourceforge_at_[hidden]> wrote:
> On 7 Mar 2014 at 19:13, Vicente J. Botet Escriba wrote:
>
>> I was aware of this issue, but I didn't reached to diagnose what was wrong.
>>
>> Could you explain me how did you found that some of them are false
>> positives?
>
> Through inspection, the usual debugging experience. Figuring out
> causes of memcheck failure is not easy nor quick.
>
> The main cause of false positives is when Boost uses atomics to
> implement low level primitives such as locks. You need to annotate
> all CAS lock operations with the fact they are CAS locks - that way a
> thread sanitiser knows you're serialising code. Otherwise it appears
> you're riddling your code with race conditions.

I think you're confusing ThreadSanitizer and AddressSanitizer. Double
free is never a false positive.

> Markup is very easy, but tedious. You effectively must audit every
> line of code.
>
>> Could you provide a patch with the needed annotations?
>
> Marking up all of Boost.Thread with all the necessary annotations and
> fixing up any problems revealed is probably a full (and extremely
> worthwhile) GSoC.

I'd be careful with such markup. I don't know how exactly
ThreadSanitizer works, but if markup means calling some function in
runtime then that's probably not an acceptable solution in the context
of atomics.