data-race leads to crash in u_trace_context_init()
Every now and then, debug_get_option_trace_format()
returns NULL
, but then we try to strcmp it, leading to a SIGSEGV
.
I can trigger this by running the glx-multithread-shader-compile
piglit test-case many times. It can take a lot of tries to trigger it, though.
Bisected to 850ae769 from !16475 (merged), which introduced this code in the first place.
The root problem here seems to be that debug_get_option_*
isn't thread-safe; it's using static variables to cache the result, so if two threads runs at the same time, one could observe first
as true
, but value
still being uninitialized.
However, running valgrind --tool=helgrind on the test reveals a lot of data-races in the iris_utrace_init
code-path, so maybe this should be fixed at a higher level than u_trace_context_init()
...