Fix: use-after-free with popt 1.19 In parse_options, we loop over all non-option arguments, adding them to opt_input_paths. Immediately after adding `ipath' to opt_input_paths, we call poptFreeContext. This has the affect of free'ing pc->leftovers, which is where these non-option arguments are stored. This is ultimately due to this upstream commit in popt 1.19: https://github.com/rpm-software-management/popt/commit/7182e4618ad5a0186145fc2aa4a98c2229afdfa8 This is derived from a package patch: https://src.fedoraproject.org/rpms/babeltrace/c/d48452beff87b145c038f070e7182358db04336c?branch=rawhide Change-Id: Icf330e53c2f4fad1d98a1ae494f2664670a0828e Reported-by: Keith Seitz <keiths@redhat.com> Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
bindings: try importing collections.abc first for forward compatibility Using the babeltrace Python module with Python 3.3-3.8 gives a warning: /usr/lib/python3/dist-packages/babeltrace/babeltrace.py:811: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working Therefore, for forward compability (Python 3.9+), try importing it using the new way first. Otherwise, fall back on the old way. Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com> Change-Id: I7f650593a013643b2fb0b77b0d388cf57bc2b765 Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: lttng-live format: do not error out on empty streams hang up Attaching to a stream hung up before providing any trace packet causes ctf_open_mmap_stream_read() to return an error. This kind of scenario can happen with the upcoming "lttng clear" feature. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: lttng-live: ctf_live_packet_seek stream hang up handling When get_next_index sets the index position to EOF, ctf_live_packet_seek() should in turn set the stream position to EOF to propagate the hung up state. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: trace-collection: trace clock use after free The trace collection should copy the trace clock object rather than take a reference to the first trace's trace clock, because it may be freed when the trace is removed (e.g. application going away in per-pid live tracing). Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: lttng-live: use-after-free in get_next_index() Running babeltrace under valgrind with a test-cases doing per-pid lttng tracing in live mode triggers this use-after-free in get_next_index() when stream is hung up. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>