This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PING] [PATCH] Fix parameters of __tsan_vptr_update
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: Dmitry Vyukov <dvyukov at google dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, Richard Biener <richard dot guenther at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 16 Jan 2015 18:42:07 +0100
- Subject: RE: [PING] [PATCH] Fix parameters of __tsan_vptr_update
- Authentication-results: sourceware.org; auth=none
- References: <DUB118-W36BD6269214D3EE6E26A4AE4510 at phx dot gbl> <20150102190102 dot GB1667 at tucnak dot redhat dot com>,<DUB118-W157955758BEE04CBCE299FE45D0 at phx dot gbl> <20150102212901 dot GG1667 at tucnak dot redhat dot com>,<DUB118-W23B6AF5E187BC7CE6646AEE45D0 at phx dot gbl> <DUB118-W23B4CFAA5A198B57689EBDE45B0 at phx dot gbl>,<DUB118-W16B4004988A5B0A3EE2CC2E4420 at phx dot gbl> <DUB118-W519443EF06A1C4DB96059EE44F0 at phx dot gbl>,<CACT4Y+YBJRzG9c4KSrykO5NbaGeAKfmJUTb7ryqk4dX_Hx5aNQ at mail dot gmail dot com>
Hi,
On Fri, 16 Jan 2015 21:25:42, Dmitry Vyukov wrote:
>
> This is just a copy from llvm repo, right?
> Looks good to me.
>
Thanks.
Yes I found these test case in the llvm tree, and just adapted them
to work in the gcc test suite.
However, here is a small tweak in the positive test:
That is we now use a tsan-invisible barrier_wait function
instead of the not very reliable sleep(1).
barrier_wait is bypassing the tsan interceptor, because
it is accessed with dlsym (dlopen ("libpthread.so.0", RTLD_LAZY),
"pthread_barrier_wait").
Bernd.
> On Fri, Jan 16, 2015 at 10:17 AM, Bernd Edlinger
> <bernd.edlinger@hotmail.de> wrote:
>> Hi,
>>
>>
>> I think I should ping for this patch now:
>> https://gcc.gnu.org/ml/gcc-patches/2015-01/msg00599.html
>>
>> note that by mistake the change log referenced sanitizer.c instead of
>> sanitizer.def, consider that fixed on my local copy.
>>
>>
>> Thanks
>> Bernd.
>>
>>
>>> Date: Sun, 11 Jan 2015 14:15:54 +0100
>>>
>>> Hi,
>>>
>>>
>>>
>>> On Sun, 4 Jan 2015 14:54:56, Bernd Edlinger wrote:
>>>>
>>>> Hi Jakub,
>>>>
>>>>
>>>> I think I have found a reasonable test case, see the attached patch file.
>>>> The use case is: a class that destroys an owned thread in the destructor.
>>>> The destructor sets the vptr again to thread::vptr but this should
>>>> _not_ trigger a diagnostic message, when the vptr does not really change.
>>>>
>>>> Jakub, this is another test case where the TREE_READONLY prevents
>>>> the tsan instrumentation. So I had first to install your patch:
>>>>
>>>> https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01432.html
>>>>
>>>> ... to see the test case fail without my patch.
>>>>
>>>
>>> that has been installed in the meantime.
>>>
>>>> The patch installs cleanly on 4.9 and 4.8, however the 4.8 branch
>>>> has no tsan tests, so I would leave the test case away for 4.8.
>>>>
>>>
>>> I found, 4.8 does not have BT_FN_VOID_PTR_PTR, and no tsan tests
>>> at all, so it is probably not worth the effort.
>>>
>>>> Boot-strapped and regression-tested on x86_64-linux-gnu
>>>> OK for trunk and 4.9 + 4.8 branches?
>>>>
>>>>
>>>> Thanks
>>>> Bernd.
>>>>
>>>>
>>>
>>> I found some test cases in the clang tree, about the __tsan_vptr_update.
>>> So I thought I should use these instead of inventing new ones.
>>>
>>> Attached you'll find an updated patch with one positive and one negative
>>> test for vptr races.
>>>
>>> Tested with x86_64-linux-gnu.
>>> OK for trunk and 4.9 after a while?
>>>
>>>
>>> Thanks
>>> Bernd.
>>>
>>