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:19:57 +0000 (09:19 -0400)
commit92d9f5e6df0f72842b28ccd303569c88e183325a
treef41eef9099bac9a38c60d70f7c808f4f01b5403b
parent96528ccaca8172e68b52254d1a80d8b6bd45cd45
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.025094 seconds and 4 git commands to generate.