Fix: race between lttng-ust getenv() and application setenv()
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 10 Mar 2017 23:08:25 +0000 (18:08 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 11 Mar 2017 13:46:21 +0000 (08:46 -0500)
The LTTng-UST listener threads invoke getenv(), which can cause issues
if the application issues setenv() concurrently. This is a legitimate
use by the application because it may have a single thread and not be
aware that it runs with liblttng-ust.

Fix this by keeping our own environment variable table for the variables
we care about. Initialize this table within the lttng-ust library
constructor, when we don't race with the application.

As this thread shows:
https://sourceware.org/bugzilla/show_bug.cgi?id=5069#c10

getenv() does _not_ appear to be thread-safe if an application uses
setenv() or putenv().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

No differences found
This page took 0.025351 seconds and 4 git commands to generate.