Fix: lttng-ctl: deserialize on orderly shutdown of sessiond
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 16 Nov 2020 21:50:41 +0000 (16:50 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 20 Nov 2020 21:50:05 +0000 (16:50 -0500)
commitbacc41cc41d9702241e7a52617fed046ed5f5506
tree29a62244bb3fddced45ad1235ca4784be1ead26d
parentf5d98ed9e6017de4d7146fd4a19dad4dab5471e3
Fix: lttng-ctl: deserialize on orderly shutdown of sessiond

Issue
=====
The `recv_data_sessiond()` function may return zero if the socket peer
has shutdown orderly. This happens if the session daemon is killed while
the client is blocked on the `recv_data_sessiond()` call. Currently,
when this happens, the client simply goes on to decode the uninitialized
reply buffer.

This bug was witnessed while developing the upcoming event-notifier
feature where complex objects are received from sessiond and attempts to
deserialize these objects resulted in segmentation faults.

Solution
========
Return -LTTNG_ERR_NO_SESSIOND when `recvmsg()` returns zero. This way,
the client can simply tell the user that the session daemon is no longer
available.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib2387526c4101e3bae706e38181bfeb25da26fa3
src/lib/lttng-ctl/lttng-ctl.c
This page took 0.02562 seconds and 4 git commands to generate.