Fix: use after free on metadata cache reallocation
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 25 Jun 2015 13:10:52 +0000 (09:10 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 25 Jun 2015 13:23:47 +0000 (09:23 -0400)
commit9a0aa3b1fd7f693fc14b29cce9eb07cd275b0347
tree7f3af727e09f96a31d306925b8f5148269010617
parent7a88f8b50696dd71e80c08661159caf8e119bf51
Fix: use after free on metadata cache reallocation

When the metadata cache is expanded (reallocated) by
lttng_metadata_printf(), the metadata cache reader
(lttng_metadata_output_channel()) may use freed memory, because the
metadata cache is not protected from concurrent read accesses. The
metadata cache updates are protected from each other by the sessions
mutex, but metadata cache reads do not hold the sessions mutex.
Actually, the comment on top of lttng_metadata_output_channel() stating
"We have exclusive access to our metadata buffer (protected by the
sessions_mutex)" is simply wrong, because this mutex is never held when
calling lttng_metadata_output_channel().

Promote the per-stream lock to the metadata cache used by each of those
metadata streams, thus ensuring mutual exclusion between metadata cache
reallocation and readers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-abi.c
lttng-events.c
lttng-events.h
This page took 0.027551 seconds and 4 git commands to generate.