Fix: liblttng-ust-libc-wrapper recursive use of calloc
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 15 Mar 2014 00:31:13 +0000 (20:31 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 15 Mar 2014 00:52:00 +0000 (20:52 -0400)
commit8c06ba6ffeeb1196fa96dfbdd0b1c9937496f70f
tree360acbf7f2bc9807641d9cc3748073e558408d28
parentaf9f5e3cb6ae7a7b4277b0e101b5cbecfa8efd25
Fix: liblttng-ust-libc-wrapper recursive use of calloc

When built with URCU with --disable-compiler-tls, URCU tls-compat.h uses
calloc in its TLS compat layer. This is used by RCU read-side, which is
used by tracepoint. So using a tracepoint in calloc triggers an infinite
recursion, since its first use of the TLS (with TLS compat) calls
calloc.

Fix this issue by keeping a per-thread nesting counter, and as soon as
we are allocating memory from a context nested within the memory
allocator, don't trace.

Don't trace from the static allocator: keep it as simple as possible,
since this is our fallback.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust-libc-wrapper/lttng-ust-malloc.c
This page took 0.025187 seconds and 4 git commands to generate.