Fix: relayd: assertion fails on creation of session by peer < 2.11
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 2 Apr 2020 19:47:30 +0000 (15:47 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 Apr 2020 23:47:19 +0000 (19:47 -0400)
commit2ce24bb817103fae885df9379405bd97c2a58b84
treeb7dda3f22cd01ee1cbf4fa670ce81d4fb0886f86
parentd7f39619a2f49f3d415a4647c7c849809027d38c
Fix: relayd: assertion fails on creation of session by peer < 2.11

Observed issue
==============

An assertion that a chunk has no active directory handle fails when
creating an anonymous chunk. More specifically, this occurs when
associating an fd tracker to the newly created anonymous trace chunk.

This occurs when a session is created by a peer that is older than
2.11.

Cause
=====

Trace chunks that should monitor their file descriptors with a file
descriptor tracker must be associated with the tracker before any
other operation occurs on the chunk. This is to ensure that "raw" file
descriptors are not created when they were meant to be tracked.

Here, the credentials and session output directory are set before the
file descriptor tracker was provided to the anonymous chunk which is a
breach of the API contract (enforced by the assert()).

Solution
========

Associate the fd tracker immediately to the anonymous chunk before
providing it with a reference to the file descriptor
tracker. Moreover, a leak of the output_directory is prevented by not
setting it to NULL. The trace chunk will acquire a reference to the
trace chunk; it is not transferred to the trace chunk.

Note
====

The problem was introduced during the 2.12 release cycle (clear
feature); this doesn't need to be backported.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I92ca2f156f500dfe02e09f8b4783447e46710246
src/bin/lttng-relayd/session.c
This page took 0.025776 seconds and 4 git commands to generate.