This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH] Fix sporadic failure in g++.dg/tsan/aligned_vs_unaligned_race.C
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Mike Stump <mikestump at comcast dot net>, "H.J. Lu" <hjl dot tools at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Dmitry Vyukov <dvyukov at google dot com>
- Date: Wed, 7 Jan 2015 15:55:11 +0100
- Subject: RE: [PATCH] Fix sporadic failure in g++.dg/tsan/aligned_vs_unaligned_race.C
- Authentication-results: sourceware.org; auth=none
- References: <E67B07D7-6ABA-48C1-B58B-B804144D91C2 at comcast dot net>,<D86529BC-DB94-481A-AE60-913D7E2B8D7F at comcast dot net>,<DUB118-W1E901D082BACEDE02A5E8E4590 at phx dot gbl>,<DUB118-W468072AA78C7E7CD1DCF6BE4590 at phx dot gbl>,<20150106091633 dot GF1667 at tucnak dot redhat dot com>,<DUB118-W15350AC346C8CE664A5ECDE4590 at phx dot gbl>,<DEA45E76-18B8-4FCA-AFE3-718F21DC1CB3 at comcast dot net>,<DUB118-W1417B0F343893BD17318BAE4590 at phx dot gbl>,<A5E27EC0-33BE-4043-8B5E-07394E68AE41 at comcast dot net>,<DUB118-W189C82F5D792A3B997EED5E4460 at phx dot gbl>,<20150107082339 dot GN1667 at tucnak dot redhat dot com>
On Wed, 7 Jan 2015 09:23:39, Jakub Jelinek wrote:
>
> But I really don't like the busy waiting. You essentially want something
> like pthread_barrier_wait that libtsan isn't aware of, right?
>
Yes.
> As tsan is only supported on x86_64-linux (and in the future could be on
> some other 64-bit linuxes), I wonder if we couldn't just simplify libgomp's
> config/linux/bar* for that purpose - libtsan doesn't intercept syscall(3)
> and doesn't intercept futex in particular, so we could have a busy waiting
> free synchronization primitive. Or another option is to just dlopen
> libpthread.so.0 and dlsym pthread_barrier_wait in it and use that, that way
> libtsan won't intercept it either.
>
That would be the honey pot. But unfortunately I can't reach it.
I tried this,
cat barrier.h
#include <dlfcn.h>
static pthread_barrier_t barrier;
static int (*barrier_wait)(pthread_barrier_t *);
__attribute__((constructor(101)))
void barrier_init()
{
pthread_barrier_init (&barrier, NULL, 2);
barrier_wait = (int (*)(pthread_barrier_t *))
dlsym (dlopen ("pthread.so.0", RTLD_NOW), "pthread_barrier_wait");
}
But dlsym gives me only a pointer to the tsan-interceptor.
Bernd.