Re: [PATCH 00/15] tools/lib/traceevent: Namespace updates to make traceevent into a library

Arnaldo Carvalho de Melo
2018-09-24T15:21:17Z

Em Mon, Sep 24, 2018 at 11:16:32AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Sep 24, 2018 at 04:55:23AM -0400, Steven Rostedt escreveu:
> > On Sun, 23 Sep 2018 20:56:26 +0200
> > Jiri Olsa <jolsa@redhat.com> wrote:

> > > is there still something left to rename, or we can start moving it into public rpm?

> > We're testing it as a external library, and we did find something. Did
> > you get this patch?

> > https://lore.kernel.org/lkml/20180921152037.1e23c7f4@gandalf.local.home

> I'm finishing tests with the patchset before this last patch, will push
> to Ingo soon, then will check if the patch with the private copy of the
> strerror_r() wrapper passes on the systems that made that wrapper came
> to be, i.e. systems using the musl libc (https://www.musl-libc.org/).

Ok, it passes on these systems:

1 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0
2 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822
3 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0
4 alpine:3.7 : Ok gcc (Alpine 6.4.0) 6.4.0
5 alpine:3.8 : Ok gcc (Alpine 6.4.0) 6.4.0
6 alpine:edge : Ok gcc (Alpine 6.4.0) 6.4.0

Which puzzled me, but then I saw that you guys are not using
strerror_r(), but strerror() that is not thread-safe, and then the
pitfalls with strerror_r() XSI/_GNU_SOURCE problems are not hit.

This same problem happened with tools/lib/bpf/, and I fixed it in by
having a separate file to create the wrapper, where we make sure
_GNU_SOURCE is not defined and continue using strerror_r():

https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/urgent&id=6d41907c630d3196be89c9ed5a7f8258486b3eaf

I think it would be interesting to use something similar so that
libtraceevent becomes thread safe for this specific point.

For now I've applied the patch to my local perf/core branch, so that it
gets tested in more systems.

- Arnaldo