Jonathan Rajotte [Tue, 26 Apr 2022 18:33:52 +0000 (14:33 -0400)]
lttng-ctl: use the parsed URI instead of raw string for override
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I0439c1ecdc935011036e3772e59f0caba017de34
Jérémie Galarneau [Mon, 4 Jul 2022 19:19:00 +0000 (15:19 -0400)]
sessiond: add a CTF 2-generating trace class visitor
The enumeration_type class is modified to guarantee that a mapping is
present. Implicit (or auto) mappings provided by the tracer are
converted to an explicit mapping.
This results in a slightly more verbose TSDL output which can be fixed
later.
Change-Id: I4372ad528384c1b7d9321dd5183525e3bd60ded4
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 26 Jul 2022 21:06:30 +0000 (17:06 -0400)]
sessiond: add variant selector intervals
In CTF 2, variant options are chosen using a set of ranges. This differs
from CTF 1.8 (and the current API) which assumed that a variant had
options that perfectly matched the selector enumeration's mappings.
Add integer mappings to variants and also carry a choice name that
becomes the name used by the TSDL producer.
Change-Id: Ib31cf9cc211dad36759bd73dc722c49d634c666b
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 26 Jul 2022 22:34:44 +0000 (18:34 -0400)]
sessiond: validate existence of field reference received from LTTng-UST
Some field descriptions received from traced applications refer to
other fields (a sequence's length field, a variant's selector field,
etc.)
Validate that those references are valid.
Change-Id: I73f5b464b007810beb228128d5bc3243e3b05157
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 26 Jul 2022 19:17:20 +0000 (15:17 -0400)]
sessiond: express field references as locations instead of names
CTF2 requires type references (a sequence's length, a variant's
selector) to be expressed as absolute field locations.
The `field` API currently expresses these references as names directly
since those are provided by the tracer.
This change introduces the notion of a field location and adapts
the tsdl visitor to serialize those as expected.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I56f603062d6748051adf3fa31bc08422c47c144d
Jérémie Galarneau [Thu, 21 Jul 2022 19:41:43 +0000 (15:41 -0400)]
sessiond: return raw pointer to packet header
There is no benefit to transfering the ownership of a new packet header
everytime it is serialized. Packet headers don't change after the
creation of a session; prefer allocating it once and provide a
raw (const) pointer to the session's instance.
While LTTng always produces one, a trace doesn't absolutely need a
packet header so a pointer is preferred over a reference.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I66b8f9ad74e332edcc8273c076137a7fff0d4d5e
Jérémie Galarneau [Wed, 13 Jul 2022 21:14:01 +0000 (17:14 -0400)]
sessiond: tsdl: remove useless std::move
append_metadata_fragment accepts the string by reference and it is
passed as such all the way; there is no need for an ownership transfer.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I49baab00c333b97f0dde49bad34fee43e7e40a2b
Jérémie Galarneau [Thu, 7 Jul 2022 16:20:33 +0000 (12:20 -0400)]
sessiond: generate packet header, packet context and event header dynamically
Instead of hardcoding event header and packet header/context layouts,
their layout is expressed using the lttng::sessiond::trace::field/type
API and serialized to TSDL using the visitor.
This reduces the duplication of code in the CTF2 visitor.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9a4255889e36e6861a59536ce70b1e708da06ac5
Jérémie Galarneau [Mon, 11 Jul 2022 19:48:49 +0000 (15:48 -0400)]
Fix: sessiond: tsdl: don't prepend underscore for stream_id
Although the CTF v1.8 specification recommends ignoring any leading
underscore, Some readers, such as Babeltrace 1.x, expect special
identifiers without a prepended underscore.
This causes problems in a follow-up patch since packet header, context,
and event headers become dynamically generated.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I0aeb24ab2e1c0ee1ea70d2fb9bb0eabbb2e9e035
Jérémie Galarneau [Mon, 4 Jul 2022 19:00:25 +0000 (15:00 -0400)]
sessiond: field: add field roles and blob types
Extend the field/field type to include the blob field types that
are used to express the trace class uuid in CTF2.
Roles defined by the CTF2 specification are also added to allow a trace
class to define the layout of some scopes (e.g. packet header and
context) instead of hard-coding the serialized version of the layout
description.
The TSDL trace class visitor takes the new types into account by
converting them into arrays of "bytes" (uint8_t).
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ic9d976416ed765b157e951bf9b8b299abbe20e5b
Jérémie Galarneau [Mon, 13 Jun 2022 18:43:22 +0000 (14:43 -0400)]
Add nlohmann/json 3.10.5 to vendor libraries
JSON is released under the MIT license. The MIT license text is already
under LICENCES.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1aab2c0af7e71248a8ce8b10240daf191d057e09
Mathieu Desnoyers [Mon, 26 Sep 2022 17:36:38 +0000 (13:36 -0400)]
Fix: event field value: assertion fails on empty string
When converting msgpack objects to their event_field_value equivalent,
the following assertion fails: LTTNG_ASSERT(val);
#4 0x00007f1f65349486 in __assert_fail () from /usr/lib/libc.so.6
#5 0x00007f1f65584da7 in lttng_event_field_value_string_create_with_size (val=0x0, size=0) at event-field-value.cpp:186
#6 0x00007f1f65576a1a in event_field_value_from_obj (obj=0x557f597ccdb8, field_val=0x7ffcc9675dd0)
at conditions/event-rule-matches.cpp:1120
#7 0x00007f1f65577176 in event_field_value_from_capture_payload (condition=0x557f597c8520,
capture_payload=0x557f597c825b "\221\240", capture_payload_size=2) at conditions/event-rule-matches.cpp:1340
#8 0x00007f1f655772ea in lttng_evaluation_event_rule_matches_create (condition=0x557f597c8520,
capture_payload=0x557f597c825b "\221\240", capture_payload_size=2, decode_capture_payload=true)
at conditions/event-rule-matches.cpp:1398
#9 0x00007f1f655765fc in lttng_evaluation_event_rule_matches_create_from_payload (condition=0x557f597c8520,
view=0x7ffcc9675ff0, _evaluation=0x7ffcc9676080) at conditions/event-rule-matches.cpp:990
#10 0x00007f1f6557f273 in lttng_evaluation_create_from_payload (condition=0x557f597c8520, src_view=0x7ffcc9676100,
evaluation=0x7ffcc9676080) at evaluation.cpp:120
#11 0x00007f1f6559ba36 in lttng_notification_create_from_payload (src_view=0x7ffcc9676190, notification=0x7ffcc9676180)
at notification.cpp:123
#12 0x00007f1f65552577 in create_notification_from_current_message (channel=0x557f597c8ee0) at channel.cpp:124
#13 0x00007f1f6555298c in lttng_notification_channel_get_next_notification (channel=0x557f597c8ee0, _notification=0x7ffcc9676280)
at channel.cpp:292
The msgpack API represents string as p-style while the implementation of
event_field_value relies on null-terminated strings. When an empty
string is captured by a tracer, it is decoded as a msgpack_object with
`str = {size = 0, ptr = 0x0}`.
lttng_event_field_value_string_create_with_size does not require a
null-terminated string since it also receives the length. Hence, this
fix causes lttng_event_field_value_string_create_with_size to accept
null strings when their length is zero. A copy of an empty string is
made to accomodate the null-termination convention used by the rest of
that API.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I7c3a839dbbeeb95a1b3bf6ddc3205a2f6b4538e3
Michael Jeanson [Tue, 20 Oct 2020 21:08:31 +0000 (17:08 -0400)]
port: BSD cut doesn't support '\0' as a delimiter
Use a combination of 'tr' and 'head' instead which works with both the
GNU and BSD version of coreutils.
Change-Id: I5628863ed41030864ec08f45a3d4153c32fc5496
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Wed, 11 Nov 2020 15:38:51 +0000 (10:38 -0500)]
Cleanup: remove ignored flags from poll events bitmasks
The POLLHUP and POLLERR flags are only valid in 'revents', they are
implicitly enabled regardless of the fact they were set in 'events' or not.
As such remove those flags from all poll events to reduce possible
confusion as to which flags can be returned by poll.
Change-Id: Id22c78c38257d96dfc47e1337795f13c70dd5f91
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Fri, 16 Jul 2021 21:52:35 +0000 (17:52 -0400)]
port: add support for BSD mktemp
Use '-t' which is portable instead of the GNU specific '--tmpdir'.
Change-Id: I430af6b96c27c2766a2cc4b5574af8563297d717
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 27 Oct 2022 21:05:23 +0000 (17:05 -0400)]
Fix: C++ syntax of FreeBSD compat code
Change-Id: I4c463bb965c34692718dadd1731f2a1fab7a1248
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Fri, 13 Nov 2020 23:19:31 +0000 (18:19 -0500)]
Tests: fix randstring() with BSD `tr`
On FreeBSD, `tr` will error out with an "Illegal byte sequence"
error when it is provided with an invalid multi-byte character.
This happens regularly when its input is random.
Forcing `tr` to use the 'C' locale works around this problem as
that locale only allows single-byte characters.
Change-Id: I8d8e84fb7f356205dd45479538e5bc0bff3c1668
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 27 Oct 2022 20:57:18 +0000 (16:57 -0400)]
Fix: tests: CFLAGS to CXXFLAGS when converting to C++
The test was converted to C++ but the custom flags used to build it were
left in the CFLAGS variable which doesn't apply to C++ code. This begs
the question of the usefulness of these flags, except for POPT_CFLAGS
which lead to this finding.
Change-Id: I87412ff0730b960b191d8725a13407c67f7b431d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 20 Oct 2020 18:42:32 +0000 (14:42 -0400)]
port: tests: uprobe is Linux specific
Change-Id: I6db00a9d01f7534874051eef7477db7dead3a670
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Fri, 16 Jul 2021 18:54:37 +0000 (14:54 -0400)]
port: build kernel tests only on linux
Change-Id: I81e4b2cf161d25aa939f312bb6a728cf9420a9d4
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Fri, 13 Nov 2020 20:10:39 +0000 (15:10 -0500)]
port: extensions are enable by AC_USE_SYSTEM_EXTENSIONS
Available extensions are enabled at configure, make the poll wrapper use
them.
Change-Id: I5a4f99f0b498152d779a2bca3e53775013fdba60
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 9 Nov 2020 16:40:37 +0000 (11:40 -0500)]
port: shutdown(2) can return ENOTCONN on FreeBSD
On FreeBSD shutdown(2) will return ENOTCONN when called on a
disconnected socket which is not the case on Linux. It will however
still run the shutdown code on the socket and wakeup threads waiting on
the socket, so we can safely ignore this specific error.
For more details see this bug report:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=227259
Change-Id: I0046382ab996060f940dd1283d18447792cf1fd3
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 10 Nov 2020 21:33:36 +0000 (16:33 -0500)]
Standardize quit pipes behavior
Standardize the behavior of the quit pipes to trigger on any poll events.
Change-Id: I0beeefcbd1a55b2aa308eb28b617487ffdeb737e
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 24 Oct 2022 14:53:40 +0000 (10:53 -0400)]
Build fix: rpath of test libraries results in non-reproducible build
Yocto has trouble making LTTng-tools builds reproducibile since
abs_builddir is used as the rpath of the test libraries under
tests/regression/ust/ust-dl/.
From their commit message:
Specifing abs_builddir as an RPATH is plain wrong when cross
compiling. Sadly, removing the rpath makes libtool/automake do weird
things and breaks the build as shared libs are no longer generated.
We already try and delete the RPATH at do_install with chrpath however
that does leave the path in the string table so it doesn't help us
with reproducibility.
Their fix consists in hardcoding /usr/lib as the rpath of those
libraries. As mentionned, the rpath doesn't matter; it's used to
workaround libtool's behaviour.
This fix uses `$libdir`, which takes the user's specified prefix into
account to generate an rpath that is consistent with the one inserted in
the other artifacts.
Note that the change in the notification tests is a bit more involved
since we have to bypass libtool to instrument a test application with
uprobes.
Fixes #1361
Change-Id: I7739956f8bc8571ef90802c3b37a4e1f21352385
Reported-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 26 Oct 2022 19:09:58 +0000 (15:09 -0400)]
Cleanup: tests: fix typos in sdt test app comments
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I88e2daf8e7175f5ac784ae373833f8e6f17808bf
Jérémie Galarneau [Tue, 25 Oct 2022 20:09:26 +0000 (16:09 -0400)]
Cleanup: tests: notification: fix typo kprobe/uprobe
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib57af09d331e559d25a62cc66c72aad567283a6e
Jonathan Rajotte [Tue, 8 Mar 2022 15:13:59 +0000 (10:13 -0500)]
Cleanup: tests: run metadata-regeneration during `make check`
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia7e300e00576d28013068b3314d537893fa3b869
Jonathan Rajotte [Tue, 8 Mar 2022 14:59:05 +0000 (09:59 -0500)]
Cleanup: tests: remove redundant tests against `make check`
These tests are already managed by the `make check` based test suite.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I72c382d22a17566ac3beaa95950efabb77405ed3
Michael Jeanson [Fri, 13 Nov 2020 17:58:17 +0000 (12:58 -0500)]
Cleanup: sessiond: rename the sessiond main thread quit pipe
Rename the sessiond main thread 'thread_quit_pipe' as the
'main_quit_pipe' to make it easier to distinguish it from the other
threads quit pipes.
While we're there, adjust some debug statements and internal function
names to distinguish between notifying the quit pipe and actually
stopping the threads.
Change-Id: I9caf81f6d03805658e2470a026b15dde03f2a88b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Thu, 11 Nov 2021 13:38:16 +0000 (08:38 -0500)]
Add some warnings useful in C++
Change-Id: Ie8f0ee45ac2f4a4883119a70869a7e4507e7bd0d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 18 Oct 2022 15:10:46 +0000 (11:10 -0400)]
Fix: never use 'no' in a command variable
Command variable may be used in the Makefiles and tests, when not found,
set them to an empty string instead of trying to execute the command
'no'.
Change-Id: I5429bb96599e3b7f166e52545269cd99eed758ae
Reported-by: Heng Guo <heng.guo@windriver.com>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 3 Feb 2022 16:19:28 +0000 (16:19 +0000)]
Tests: improve trace match reporting
Add information to the various trace match function tests output to help
with diagnose test failures.
Change-Id: Ibd2943fe3d17829e216ae5aebaff48a2ad5ca875
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 13 Oct 2022 16:29:28 +0000 (17:29 +0100)]
sessiond-comm: prefix lttcomm_sessiond_command entries
Add LTTCOMM_SESSIOND_COMMAND as the prefix of sessiond client commands
to honor the usual namespacing convention.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie0f9c5282d442e27bcdbbf390ab23d6076c413de
Jérémie Galarneau [Thu, 13 Oct 2022 13:28:59 +0000 (14:28 +0100)]
Fix: sessiond: abort called on undefined client command
Issue observed
--------------
When running in verbose mode, the session daemon calls abort()
when it receives an unknown client command:
#1 0x00007f66ffd69958 in raise () from /usr/lib/libc.so.6
#2 0x00007f66ffd5353d in abort () from /usr/lib/libc.so.6
#3 0x000055a671a6f6bd in lttcomm_sessiond_command_str (cmd=
1633771873)
at ../../../src/common/sessiond-comm/sessiond-comm.hpp:199
#4 0x000055a671a73897 in process_client_msg (cmd_ctx=0x7f66f5ff6d10,
sock=0x7f66f5ff6c34, sock_error=0x7f66f5ff6c38) at client.cpp:1006
#5 0x000055a671a777fc in thread_manage_clients (data=0x55a673956100)
at client.cpp:2622
#6 0x000055a671a6d290 in launch_thread (data=0x55a673956170) at thread.cpp:68
Cause
-----
process_client_msg() logs the client command on entry. While it
previously logged the numerical value, it now provides the string-ified
version of the command id (since
19f912db8).
The lttcomm_sessiond_command_str() function aborts when it encounters an
unknown command id. This is reasonable (in so far that it is how we
handle these situations, typically). However, the validity of the
command must be checked beforehand as it comes from an
external (untrusted) source.
Solution
--------
Add lttcomm_sessiond_command_is_valid and tombstone command IDs to
lttcomm_sessiond_command to ensure only valid command ids are passed
to lttcomm_sessiond_command_str when logging.
Drawbacks
---------
None
Reported-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ibd36f1e69da984c7f27b55ec68e5e3fe06d7ac91
Alistair Francis [Fri, 7 Oct 2022 00:39:17 +0000 (10:39 +1000)]
README: Update the Userspace RCU requirements
Commit
cc22de985fbd "Bump URCU dependency to 0.14" increase the
Userspace RCU requirements but didn't update the README. Let's ensure
the README has the correct information.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1557bb7d8457eb2a7c0909d9aaee1c69c440aa08
Jonathan Rajotte [Mon, 6 Jun 2022 19:48:16 +0000 (15:48 -0400)]
Fix: sessiond: uninitialized bytes sent to lttng-ust
Valgrind reports:
==
3421594== Thread 9 UST registratio:
==
3421594== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s)
==
3421594== at 0x4DCA12D: __libc_sendmsg (sendmsg.c:28)
==
3421594== by 0x4DCA12D: sendmsg (sendmsg.c:25)
==
3421594== by 0x4B6BDE2: ustcomm_send_unix_sock (ustcomm.c:323)
==
3421594== by 0x4B31549: lttng_ust_ctl_send_counter_data_to_ust (ustctl.c:3167)
==
3421594== by 0x18E8D8: send_counter_data_to_ust(ust_app*, lttng_ust_abi_object_data*) (event-notifier-error-accounting.cpp:535)
==
3421594== by 0x18EDE4: event_notifier_error_accounting_register_app(ust_app*) (event-notifier-error-accounting.cpp:647)
==
3421594== by 0x1AA796: ust_app_setup_event_notifier_group(ust_app*) (ust-app.cpp:4252)
==
3421594== by 0x184AC1: thread_dispatch_ust_registration(void*) (dispatch.cpp:420)
==
3421594== by 0x178192: launch_thread(void*) (thread.cpp:68)
==
3421594== by 0x4DBE608: start_thread (pthread_create.c:477)
==
3421594== by 0x4EF8162: clone (clone.S:95)
==
3421594== Address 0x6f3e2fc is 28 bytes inside a block of size 192 alloc'd
==
3421594== at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==
3421594== by 0x4B2BC3F: zmalloc (macros.h:23)
==
3421594== by 0x4B2BC3F: lttng_ust_ctl_duplicate_ust_object_data (ustctl.c:1332)
==
3421594== by 0x18ED4F: event_notifier_error_accounting_register_app(ust_app*) (event-notifier-error-accounting.cpp:638)
==
3421594== by 0x1AA796: ust_app_setup_event_notifier_group(ust_app*) (ust-app.cpp:4252)
==
3421594== by 0x184AC1: thread_dispatch_ust_registration(void*) (dispatch.cpp:420)
==
3421594== by 0x178192: launch_thread(void*) (thread.cpp:68)
==
3421594== by 0x4DBE608: start_thread (pthread_create.c:477)
==
3421594== by 0x4EF8162: clone (clone.S:95)
==
3421594== Uninitialised value was created by a stack allocation
==
3421594== at 0x18DCF3: ust_error_accounting_entry_create(ust_app const*) (event-notifier-error-accounting.cpp:377)
The underflow/overflow indices are left uninitialized and are ultimately
sent.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6dfff2e39a8fda0e74dd874ab34be66845629069
Jérémie Galarneau [Thu, 23 Jun 2022 18:28:01 +0000 (14:28 -0400)]
Clean-up: consumerd: reduce duplication of stream output close code
The kernel space consumer implements its own version of a stream_close
operation where it could use the common consumer code. This change
separates the tear down of the buffers (munmap, in the kernel case) from
the closing of the output stream in consumer_stream_close().
This change allows the kernel snapshot code to re-use the common
close function instead of rolling its own `finalize_snapshot_stream`.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I48e3193ceb3c15ddd8c6fcecd37ab60b793f7e66
Jonathan Rajotte [Wed, 1 Jun 2022 19:20:55 +0000 (15:20 -0400)]
Fix: consumer: snapshot: assertion on subsequent snapshot
Observed issue
==============
While a snapshot is being taken, the containing folder can disappear
unexpectedly. This can lead to the following errors, which are expected
and mostly handled fine:
PERROR - 14:47:32.
002564464 [
2922498/
2922507]: Failed to open file relative to trace chunk file_path = "channel0_0", flags = 577, mode = 432: No such file or directory (in _lttng_trace_chunk_open_fs_handle_locked() at trace-chunk.cpp:1411)
Error: Failed to open stream file "channel0_0"
Error: Snapshot channel failed
The problem happens on the subsequent snapshot for the session:
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007fbbdadb3859 in __GI_abort () at abort.c:79
#2 0x00007fbbdadb3729 in __assert_fail_base (fmt=0x7fbbdaf49588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55c4212cfbb5 "!stream->trace_chunk", file=0x55c4212cf820 "kernel-co
#3 0x00007fbbdadc5006 in __GI___assert_fail (assertion=0x55c4212cfbb5 "!stream->trace_chunk", file=0x55c4212cf820 "kernel-consumer/kernel-consumer.cpp", line=188, function=0x55c4212cfb00 "
#4 0x000055c421268cc6 in lttng_kconsumer_snapshot_channel (channel=0x7fbbc4000b60, key=1, path=0x7fbbd37f8fd4 "", relayd_id=
18446744073709551615, nb_packets_per_stream=0) at kernel-consume
#5 0x000055c42126b39d in lttng_kconsumer_recv_cmd (ctx=0x55c421b80a90, sock=31, consumer_sockpoll=0x7fbbd37fd280) at kernel-consumer/kernel-consumer.cpp:986
#6 0x000055c4212546d1 in lttng_consumer_recv_cmd (ctx=0x55c421b80a90, sock=31, consumer_sockpoll=0x7fbbd37fd280) at consumer/consumer.cpp:2090
#7 0x000055c421259963 in consumer_thread_sessiond_poll (data=0x55c421b80a90) at consumer/consumer.cpp:3281
#8 0x00007fbbdaf8b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#9 0x00007fbbdaeb0163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
How to reproduce:
1. Setting a breakpoint on snapshot_channel() inside
src/common/ust-consumer/ust-consumer.cpp
2. When the breakpoint hits, remove the the complete lttng directory
containing the session data.
3. Continue the lttng_consumerd process from gdb.
4. In that case you see a negative return value -1 from
consumer_stream_create_output_files() inside snapshot_channel().
5. Take another snapshot and lttng_consumerd crashes because
of the `assert(!stream->trace_chunk)` in snapshot_channel().
This last action does not require any breakpoint intervention.
Cause
=====
During the snapshot, the stream is assigned the channel current chunk.
It is expected that the stream does not have a chunk at this point.
The error handling is faulty here, the stream chunk must be
invalidated/reset on error to allow its reuse later on.
The problem exists for both consumer domains (user/kernel).
Solution
========
For the ust consumer, we can directly use the `error_close_stream`
label.
For the kernel consumer, the code path is slightly different since it
does not uses `consumer_stream_close`. Note that `consumer_stream_close`
cannot be used as is for the kernel consumer. The current implementation
partially resembles `consumer_stream_close` at the end of the iteration.
It is extracted to its own function for easier reuse from the new
`error_finalize_stream` label.
Known drawbacks
=========
None.
Fixes: #1352
Signed-off-by: Marcel Hamer <marcel.hamer@windriver.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9fc81917b19aa436ed8e8679672648f2d5baf41a
Mathieu Desnoyers [Thu, 23 Jun 2022 20:27:41 +0000 (16:27 -0400)]
Fix: waiter: futex wait: handle spurious futex wakeups
Observed issue
==============
The waiter lttng_waiter_wait() implements a futex wait/wakeup
scheme similar to the liburcu workqueue code, which has an issue with
spurious wakeups.
A spurious wakeup on lttng_waiter_wait can cause
lttng_waiter_wait to reach label skip_futex_wait with a
waiter->state state of WAITER_WAITING, which is unexpected. It would
cause busy-waiting on WAITER_TEARDOWN state to start early. The
wait-teardown stage is done with WAIT_ATTEMPTS active attempts,
following by attempts spaced by 10ms sleeps. I do not expect that these
spurious wakeups will cause user-observable effects other than being
slightly less efficient that it should be.
This issue will cause spurious unexpected high CPU use, but will not
lead to data corruption.
Cause
=====
From futex(5):
FUTEX_WAIT
Returns 0 if the caller was woken up. Note that a wake-up can
also be caused by common futex usage patterns in unrelated code
that happened to have previously used the futex word's memory
location (e.g., typical futex-based implementations of Pthreads
mutexes can cause this under some conditions). Therefore, call‐
ers should always conservatively assume that a return value of 0
can mean a spurious wake-up, and use the futex word's value
(i.e., the user-space synchronization scheme) to decide whether
to continue to block or not.
Solution
========
We therefore need to validate whether the value differs from
WAITER_WAITING in user-space after the call to FUTEX_WAIT returns 0.
Known drawbacks
===============
None.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ida9905d1f0b5d9543c8b85ecbd7d748a6f7c1c97
Mathieu Desnoyers [Thu, 23 Jun 2022 20:15:51 +0000 (16:15 -0400)]
Fix: futex wait: handle spurious futex wakeups
Observed issue
==============
The futex futex_nto1_wait() implements a futex wait/wakeup scheme
identical to the liburcu workqueue code, which has an issue with
spurious wakeups.
A spurious wakeup on futex_nto1_wait can cause futex_nto1_wait to return
with a futex state of -1, which is unexpected.
futex_nto1_wait is used by the relayd live dispatcher thread, by the
relayd main dispatcher thread, as well as by the sessiond dispatcher
thread.
Given that following a futex_nto1_wait returning due to a spurious
wakeup futex_nto1_prepare will set the futex value to -1, things go
back to normal for the following futex_nto1_wait calls.
Therefore, the only impact of this issue is to spuriously use slightly
more CPU time than strictly required.
The effect is even shorter-lasting that in the liburcu counterparts
because futex_nto1_prepare explicitly sets the futex state to -1 rather
than use an atomic decrement, which immediately sets to state back to
a consistent state.
Cause
=====
From futex(5):
FUTEX_WAIT
Returns 0 if the caller was woken up. Note that a wake-up can
also be caused by common futex usage patterns in unrelated code
that happened to have previously used the futex word's memory
location (e.g., typical futex-based implementations of Pthreads
mutexes can cause this under some conditions). Therefore, call‐
ers should always conservatively assume that a return value of 0
can mean a spurious wake-up, and use the futex word's value
(i.e., the user-space synchronization scheme) to decide whether
to continue to block or not.
Solution
========
We therefore need to validate whether the value differs from -1 in
user-space after the call to FUTEX_WAIT returns 0.
Known drawbacks
===============
None.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8a1b6aaf77b6a2f941fd4f89b61bed71cf17906b
Jonathan Rajotte [Fri, 8 Jul 2022 21:19:32 +0000 (17:19 -0400)]
Fix: ust metadata: resample clock on regenerate metadata
Observed issue
==============
The system test jobs complain that the clock regeneration is broken
since the move to the tsdl visitor approach for metadata generation.
# Test UST local with metadata regeneration
# destructive//../../src/bin/lttng/lttng create regen -o /tmp/tmp.metadata_regen_after_data_change.Vzb0vL
ok 23 - Create session regen in -o /tmp/tmp.metadata_regen_after_data_change.Vzb0vL
# destructive//../../src/bin/lttng/lttng enable-event tp:tptest -s regen -u
ok 24 - Enable ust event tp:tptest for session regen
# destructive//../../src/bin/lttng/lttng start regen
ok 25 - Start tracing for session regen
# destructive//../../src/bin/lttng/lttng stop regen
ok 26 - Stop lttng tracing for session regen
ok 27 - Validate trace at date 1970-02-02
# destructive//../../src/bin/lttng/lttng start regen
ok 28 - Start tracing for session regen
# destructive//../../src/bin/lttng/lttng regenerate metadata -s regen
ok 29 - Metadata regenerate regen
# destructive//../../src/bin/lttng/lttng stop regen
ok 30 - Stop lttng tracing for session regen
# destructive//../../src/bin/lttng/lttng destroy regen
ok 31 - Destroy session regen
not ok 32 - The trace is not at the expected date
# Failed test 'The trace is not at the expected date'
# in destructive//../utils/tap/tap.sh:fail() at line 159.
Cause
=====
Previously the clock was sampled on each call to `ust_metadata_session_statedump`
, currently the clock is only sampled on creation of the
`lttng::sessiond::ust::registry_session::registry_session` object.
Solution
========
On `lsu::registry_session::regenerate_metadata`, sample the clock and
replace the registry_session _clock object.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I6f671e4c01f71e1574824236cef03915a9c79b36
Jérémie Galarneau [Mon, 22 Aug 2022 15:25:21 +0000 (11:25 -0400)]
Fix: utils: unhandled close return value
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3f932ac53e6b39c86babe726d5ec8e9ba999e561
Jonathan Rajotte [Thu, 21 Jul 2022 13:30:27 +0000 (09:30 -0400)]
Fix: agent port file is o+w when launching as root
Observed issue
==============
When starting as root, the following permissions are observed:
[-rw-rw-rw-] agent.port
[-rw-r--r--] lttng-sessiond.pid
When starting as user:
[-rw-rw----] agent.port
[-rw-rw-r--] lttng-sessiond.pid
Note that despite being created by the same function,
`utils_create_pid_file`, the permissions are not the same.
Cause
=====
`get_wait_shm` manipulates the umask and does not restore it, thus
influencing the outcome of following file creations that don't enforce
specific permissions (using chmod).
Also `fopen` defaults to mode `0666 & ~umask`, thus resulting in
unnecessarily lax permissions when the session daemon is started as a
non-privileged user (umask = 0002, most of the time).
Solution
========
Mimic other call sites of umask(), modify then revert the umask.
Open the pid and agent port files as 0644 letting the umask to do its
job as necessary for those files.
Remove unnecessary umask() usage when chmod is directly used.
Known drawbacks
===============
Use of umask in a multi-threaded process is not recommended. Still our
current usage is limited and mostly happens during the initialization
phase. The usage of umask() is required for the `wait_shm` since on
FreeBSD it is not possible to chmod an shm file descriptor. The default
umask would interfere here.
Discussion
==========
The usage in run-as is valid even when in no-clone mode (valgrind) since
it is the sole user of umask() following the initialization phase. When
spawned as a separate process the clearing of umask is totally valid
even if it is not ideal since we are ignoring any umask set by the user.
It seems like the current usage is the lesser evil here.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie224d254714fff05f4bced471ebfa8f19eede26a
Michael Jeanson [Tue, 9 Aug 2022 15:38:16 +0000 (15:38 +0000)]
Fix: tests: don't assume sequential cpuids
On Linux CPU ids aren't sequential if a CPU is offlined or unplugged.
Get the list of currently available CPU ids from sysfs and pick a random
one, if sysfs is not available use the previous behavior.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ibdb63c7d036389104ac2f629827a6dce59e06983
Jérémie Galarneau [Fri, 8 Jul 2022 15:45:01 +0000 (11:45 -0400)]
Fix: sessiond: null pointer dereference on initial evaluation of session
Coverity reports:
1490492 Dereference after null check
Either the check against null is unnecessary, or there may be a null
pointer dereference.
In evaluate_session_condition(lttng_condition const *, session_info const *, session_state_sample const *, lttng_evaluation **): Pointer is checked against null but then dereferenced anyway (CWE-476)
This function is used to evaluate the initial state of a session and its
transitions against a given condition.
In the case of an initial evaluation, the wrong state sample is used
which results in a null dereference.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia465e26d2bf0dae725504915fa62332ecf8c7784
Jérémie Galarneau [Tue, 5 Jul 2022 20:43:26 +0000 (16:43 -0400)]
Tests: size-based rotation: implement a trace size cutoff protection
Stop waiting for rotations when the trace exceeds a certain size cutoff.
This prevents those tests from filling a hard drive when they fail.
However, this check is racy since it is possible for an arbitrary number
of apps to run before the session daemon gets a chance to perform the
scheduled rotations.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I465462e6f1d5c17ada2b3aceb68662d8663254eb
Jérémie Galarneau [Wed, 6 Jul 2022 16:09:41 +0000 (12:09 -0400)]
Fix: sessiond: handle empty scheduled rotations
A number of error codes were added to cmd_rotate_session since the
implementation of size-based rotations. The rotation thread doesn't
expect LTTNG_ERR_ROTATION_MULTIPLE_AFTER_STOP and
LTTNG_ERR_ROTATION_AFTER_STOP_CLEAR which are not fatal failures.
These rotations would simply result in an empty trace archive and are,
therefore, not produced. In both cases, it is safe to wait for the next
size cycle.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib90526b586de17c0b14d16970c862d9f981ed464
Jérémie Galarneau [Tue, 5 Jul 2022 22:31:15 +0000 (18:31 -0400)]
Clean-up: sessiond: remove left-over code
ust_metadata_channel_statedump no longer exists and _metadata_dumped
is unused.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2fa3f3bcb8d1c5a779ab1cfa0375174b479ed21f
Jérémie Galarneau [Wed, 22 Jun 2022 19:05:55 +0000 (15:05 -0400)]
Tests: rotation: add a kernel size-based rotation test
Change-Id: I035814dcbe5e74227f907bae300eacffd132d80f
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 22 Jun 2022 17:52:43 +0000 (13:52 -0400)]
Tests: rotation: add a per-pid size-based rotation test
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8f6875567d52dd7d28000ff34fff47f992cdab3f
Jérémie Galarneau [Tue, 21 Jun 2022 04:42:34 +0000 (00:42 -0400)]
Tests: add a local size-based rotation test in per-uid buffering mode
This test runs an application up until we observe four archived traces.
Unfortunately, we can't validate their size since they are approximative.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iecdbf3ee33ed02745a99e7af22c0645b4375413e
Jérémie Galarneau [Thu, 30 Jun 2022 16:03:23 +0000 (12:03 -0400)]
Fix: sessiond: report client list allocation failure as a fatal error
Report the failure to allocate a notification client list as a fatal
notification thread error.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8f2654020d0d890cc9275d445fdeccde940d2ae0
Jérémie Galarneau [Wed, 29 Jun 2022 20:37:54 +0000 (16:37 -0400)]
Fix: leak of channel-bound trigger list element
The list element is never free'd when a channel-bound trigger
is unregistered.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I32c4ee4512c460363e3384c2e3aac9feff4343b1
Jérémie Galarneau [Tue, 28 Jun 2022 03:36:22 +0000 (23:36 -0400)]
Fix: sessiond: size-based rotation threshold exceeded in per-pid tracing (2/2)
For a complete description of the original problem, refer to the previous
commit.
This change implements the second part of the fix.
Buffer statistic samples are augmented to include the channel's session
id. Since a session can outlive its channels (on the session daemon
side), the consumed size conditions are now bound to the session.
This means that the "total consumed" state is now part of the
session_info structure exclusively which, overall, is cleaner.
A side-effect of this change is that consumed size conditions are now
also evaluated when a trigger is registered or when a client subscribes
to it via a notification channel instead of waiting until the next
monitoring sample.
The buffer statistics sample also expresses a "consumed size" that is
relative to the last sample that was successfully sent.
Finally, the consumer daemon sends a final buffer statistics sample when
a channel is torn down. As explained in more detail in the previous
commit, this makes the accounting of per-pid sessions more reliable when
short-live applications are traced.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I322b9f20977e59c63cf2a4254c97c4ee657e933e
Jérémie Galarneau [Mon, 27 Jun 2022 16:01:48 +0000 (12:01 -0400)]
Fix: sessiond: size-based rotation threshold exceeded in per-pid tracing (1/2)
Issue observed
--------------
When tracing short-lived applications with buffers configured in per-pid
mode, the size-based rotation threshold is often greatly exceeded. In
the CI, this occasionally causes the size-based rotation tests to
timeout for the per-pid case.
Cause
-----
There is a scenario where a session's consumed size is miscalculated.
When an application exits during per-pid tracing, both the session and
consumer daemons notice it. The session daemon sees the application's
command pipe hanging-up, while the consumer daemon sees the
application's data-ready pipe hanging-up.
Upon handling these events, both daemons tear down their representation of
the channels.
In an ideal world, we'd want to sample the streams' "consumed_size" at
the last possible moment to get the size of all consumed data for this
stream. However, this is problematic in the following scenario:
- the sessiond destroys the channel before the consumer daemon,
- the consumer daemon sends a final buffer stats sample on tear down,
- the sessiond can do nothing with the sample as it doesn't know that
channel anymore.
(Note that the session daemon gracefully handles the case where it
doesn't know a channel.)
When applications have a short lifetime and are traced in per-PID
buffering mode, there is a high likelihood that the last buffer
statistics sample sent for a given channel will target a channel that
the session daemon has already torn down.
Solution
--------
Consumed-size conditions are somewhat special: they are bound to a
session, but they are evaluated through a per-channel event (buffer
statistics samples taken by the channels' monitoring timer).
To work around the problem of lifetime of channels, we can rely
on the fact that sessions outlive channels to perform the accounting
of the consumed size.
This patch is the first step to implement this fix: new
notification-thread commands are introduced to announce the creation and
destruction of an `ltt_session`. Currently, the notification thread
implies the existence of a session by tracking its channels' creation
and destruction.
With this change, it no longer needs to do so; session are explicitly
created and destroyed. Their unique ID is also kept stored.
The key of `sessions_ht` becomes the `id` of the session to allow
efficient look-ups on the reception of a buffer statistics sample.
The existing callsites that make use of the session's name to perform a
look-up are modified to look-up the id by name (see
sample_session_id_by_name()).
The add/remove channel commands and rotation ongoing/completed commands
are modified to refer to sessions by ID since they can assume the
notification thread knows about the session.
Note
----
In a follow-up patch, buffer statistics samples are modified to include
the session's ID and the consumed size is modified to become a "delta"
relative to the previous sample associated with a given channel.
This makes it possible to perform the accounting of a session's consumed
size beyond the lifetime of its channels.
The follow-up patch is the "core" of the fix, but it requires these
prior changes.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I865e9ac5e1a63e62123209be63957dad28c588a8
Jérémie Galarneau [Tue, 21 Jun 2022 20:56:23 +0000 (16:56 -0400)]
consumerd: send a buffer static sample on flush command
When application exits during per-pid tracing, both the session and
consumer daemons notice it. The session daemon sees the application's
command pipe hanging-up, while the consumer daemon sees the
application's data-ready pipe hanging-up.
Upon handling this event, both daemons tear down their representation of
the channels.
In an ideal world, we'd want to sample the streams' "consumed_size" at the
last possible moment to get the size of all consumed data for this
stream. However, this is problematic in the following scenario:
- the sessiond destroys the channel before the consumer daemon,
- the consumer daemon sends a final buffer stats sample on tear down,
- the sessiond can do nothing with the sample as it doesn't know that
channel anymore.
Note that the session daemon handles the case where it doesn't know a
channel gracefully.
When an application being traced in per-pid mode is torn down, the
session requests a flush of its buffers to the consumer daemon. We can
use this opportunity to emit a buffer stats sample.
This is still racy since the tear down of the channel could complete on
the session daemon's end before that last sample can be processed. In
practice, though, it markedly improves the precision of size-based
rotations in per-pid tracing mode.
On my work machine, I see the size-based rotation tests pass with
archive sizes within ~10% of the size threshold. Before this, we lost a
lot of samples from short-lived buffers and it would not be rare to see
archives end-up multiple times (5x-10x) larger than the size-threshold.
Another problem is that the consumed_size returned by the consumer
daemon will not include the packets that have yet to be consumed.
Whether or not this is a fix is debatable since it arguably just
improves the precision of size-based rotations.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8a72328ba1733ac2f50c77a1ff81d7a6aaac095c
Jérémie Galarneau [Tue, 21 Jun 2022 20:46:29 +0000 (16:46 -0400)]
consumerd: rename `data_read` to `has_data_left_to_be_read_before_teardown`
Document the sequence of events after a stream hangs up and rename
the `data_read` stream attribute to give it a more specific name.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id7d26fa04fc0d2f0875dced18b6a3f6a7fe7d139
Jérémie Galarneau [Tue, 21 Jun 2022 20:21:17 +0000 (16:21 -0400)]
Fix: ust-consumerd: set `hangup_flush_done` in a locked context
hangup_flush_done is updated after releasing the stream lock. This
doesn't appear to be a problem right now since this attribute is
apparently always accessed by the same thread, but it is conceptually
sus.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I191cb01b02c3d96e19034e0d0e80cb7f8dff2140
Jérémie Galarneau [Fri, 17 Jun 2022 20:53:53 +0000 (16:53 -0400)]
Fix: sessiond: size-based rotations never trigger
Issue observed
==============
Size-based scheduled rotations have no effect.
Cause
=====
Since
c08136a3f, the rotation thread's handle_condition() checks that
the notification received matches the trigger that was registered.
As part of the equality check, the triggers' credentials are compared.
This checks fails systematically since the group id of a trigger's
credentials is not transported by the serialize/create_from functions.
The trigger that is received through the notification thus has an unset
group id, while the rotation trigger of the `ltt_session` has a group id
set; it was not stripped by the communication layer.
The check also fails since the trigger registered for the size-based
rotation is "hidden". This internal attribute is not propagated through
the communication layer, which causes the comparison to fail.
Solution
========
Since triggers only use the 'uid' part of lttng_credentials, we ensure
that lttng_trigger_set_credentials only sets this part of the structure.
Also, the `is_hidden` attribute of a trigger is now propagated through
the communication layer. This has no effect for external applications
since this attribute is not exposed through the API. However, it is
useful for internal triggers which use the same communication
facilities.
This allows the equality check in rotation-thread.cpp to go through as
expected.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I216f5cb9297ecd1a867dc292c10b8da595efce34
Michael Jeanson [Tue, 12 Apr 2022 20:55:50 +0000 (16:55 -0400)]
Bump URCU dependency to 0.14
Complete C++ support was introduced in Userspace-RCU 0.14, using earlier
versions results in a build failure, this should be reflected in the
configure check.
Change-Id: I1b708bd9b04784deb9f2c8768a331911c3ebb891
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 16 Jun 2022 21:36:41 +0000 (17:36 -0400)]
Build fix: missing initializer for member 'payload'
gcc 5.4.0 complains that:
channel.cpp:584:2: warning: missing initializer for member 'lttng_notification_channel_message::payload' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia5a5f37f6fe6977169771e4a298d1ce73ab74ea4
Jérémie Galarneau [Thu, 16 Jun 2022 21:36:41 +0000 (17:36 -0400)]
Build fix: missing initializer for member 'override_name'
gcc 5.4.0 complains that:
relayd/relayd.cpp:1353:2: warning: missing initializer for member 'lttcomm_relayd_create_trace_chunk::override_name' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6607c46e4aa98017183f41fc8be9b0226b70cf29
Jérémie Galarneau [Thu, 16 Jun 2022 21:36:41 +0000 (17:36 -0400)]
Build fix: missing initializer for member 'rotate_positions'
gcc 5.4.0 complains that:
relayd/relayd.cpp:1221:2: warning: missing initializer for member 'lttcomm_relayd_rotate_streams::rotation_positions' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If0ecd9c9b2c5a0861463e93a2a52b0d2b3a36712
Jérémie Galarneau [Thu, 16 Jun 2022 21:36:41 +0000 (17:36 -0400)]
Build fix: missing initializer for member 'payload'
gcc 5.4.0 complains that:
notification.cpp:43:57: warning: missing initializer for member 'lttng_notification_comm::payload' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iebb2f14df21f6db9dceaf708af6ef12efda1b929
Jérémie Galarneau [Thu, 16 Jun 2022 21:36:41 +0000 (17:36 -0400)]
Build fix: missing initializer for member 'payload'
gcc 5.4.0 complains that:
event.cpp:1238:53: warning: missing initializer for member 'lttng_event_context_comm::payload' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id7c01cd19cbf884efd16734239cae8476b798c20
Jérémie Galarneau [Thu, 16 Jun 2022 21:36:41 +0000 (17:36 -0400)]
Build fix: missing initializer for member 'payload'
gcc 5.4.0 complains that:
event.cpp:769:3: warning: missing initializer for member 'lttng_event_exclusion_comm::payload' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I22ccd0c84669951f6e0a13663e47b1d2a204d3a8
Jérémie Galarneau [Thu, 16 Jun 2022 21:36:41 +0000 (17:36 -0400)]
Build fix: missing initializer for member 'payload'
gcc 5.4.0 complains that:
event.cpp:769:3: warning: missing initializer for member 'lttng_event_exclusion_comm::payload' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iac3eedff2d79843c910b4da5edec4d7f10fa062a
Jérémie Galarneau [Thu, 16 Jun 2022 21:36:41 +0000 (17:36 -0400)]
Build fix: missing initializer for member 'payload'
gcc 5.4.0 complains that:
error-query.cpp:777:2: warning: missing initializer for member '{anonymous}::lttng_error_query_comm::payload' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1264bc2da7e8ff6ec6c740341a381b33bae643d1
Jérémie Galarneau [Thu, 16 Jun 2022 21:36:41 +0000 (17:36 -0400)]
Build fix: missing initializer for member 'payload'
gcc 5.4.0 complains that:
error-query.cpp:570:2: warning: missing initializer for member '{anonymous}::lttng_error_query_results_comm::payload' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib1a297eaf2fd75b908573ac252b433a14423add5
Jérémie Galarneau [Thu, 16 Jun 2022 21:36:41 +0000 (17:36 -0400)]
Build fix: missing initializer for member 'payload'
gcc 5.4.0 complains that:
error-query.cpp:318:2: warning: missing initializer for member '{anonymous}::lttng_error_query_result_comm::payload' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie194864415bc3bc32bda6b2ac17150bd3f163394
Jérémie Galarneau [Thu, 16 Jun 2022 21:36:41 +0000 (17:36 -0400)]
Build fix: missing initializer for member 'payload'
gcc 5.4.0 complains that:
evaluation.cpp:30:2: warning: missing initializer for member 'lttng_evaluation_comm::payload' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2784138b00af34b2bc47ed28097ab32afaa379d2
Jérémie Galarneau [Thu, 16 Jun 2022 21:36:41 +0000 (17:36 -0400)]
Build fix: missing initializer for member 'indexes'
gcc 5.4.0 complains that:
actions/path.cpp:191:7: warning: missing initializer for member '{anonymous}::lttng_action_path_comm::indexes' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3b365e89c6a11cf65f609a4e14ae972faa2a518d
Jérémie Galarneau [Thu, 16 Jun 2022 21:36:41 +0000 (17:36 -0400)]
Build fix: missing initializer for member 'payload'
gcc 5.4.0 complains that:
notification-thread-events.cpp:3755:2: warning: missing initializer for member 'lttng_notification_channel_message::payload' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4e3f32da956764cd9beba6f4c72cfc48251b8203
Jérémie Galarneau [Thu, 16 Jun 2022 21:31:20 +0000 (17:31 -0400)]
Build fix: missing initializer for member 'rotation_positions'
gcc 5.4.0 complains that:
main.cpp: In function 'ssize_t relay_unpack_rotate_streams_header(const lttng_buffer_view*, lttcomm_relayd_rotate_streams*)':
main.cpp:2547:2: warning: missing initializer for member 'lttcomm_relayd_rotate_streams::rotation_positions' [-Wmissing-field-initializers]
The structure's members are initialized one by one.
At the same time, the use of the address of a packed
member (stream_count) is eliminated, which fixes another unrelated
warning emited by clang.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I5fd90d75cc6e0ba17350fc8092929f476e93757e
Jonathan Rajotte [Wed, 15 Jun 2022 19:09:03 +0000 (15:09 -0400)]
Build fix: specialization of template in different namespace
Observed issue
==============
On older g++, such as gcc (Ubuntu 5.3.1-14ubuntu2) 5.3.1
20160413:
make[3]: Entering directory '/tmp/virtenv/src/lttng-tools/src/bin/lttng-sessiond'
CXX utils.lo
In file included from ust-app.hpp:15:0,
from lttng-sessiond.hpp:22,
from utils.cpp:17:
../../../src/common/format.hpp:17:24: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]
DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES
^
In file included from ust-app.hpp:15:0,
from lttng-sessiond.hpp:22,
from utils.cpp:17:
../../../src/common/format.hpp:23:13: error: specialization of 'template<class T, class Char, class Enable> struct fmt::v8::formatter' in different namespace [-fpermissive]
struct fmt::formatter<std::type_info> : fmt::formatter<std::string> {
^
In file included from ../../../src/common/format.hpp:19:0,
from ust-app.hpp:15,
from lttng-sessiond.hpp:22,
from utils.cpp:17:
../../../src/vendor/fmt/core.h:707:8: error: from definition of 'template<class T, class Char, class Enable> struct fmt::v8::formatter' [-fpermissive]
struct formatter {
^
In file included from ust-registry.hpp:20:0,
from ust-app.hpp:19,
from lttng-sessiond.hpp:22,
from utils.cpp:17:
ust-registry-event.hpp:66:13: error: specialization of 'template<class T, class Char, class Enable> struct fmt::v8::formatter' in different namespace [-fpermissive]
struct fmt::formatter<lttng::sessiond::ust::registry_event> : fmt::formatter<std::string> {
^
In file included from ../../../src/common/format.hpp:19:0,
from ust-app.hpp:15,
from lttng-sessiond.hpp:22,
from utils.cpp:17:
../../../src/vendor/fmt/core.h:707:8: error: from definition of 'template<class T, class Char, class Enable> struct fmt::v8::formatter' [-fpermissive]
struct formatter {
^
In file included from ust-app.hpp:19:0,
from lttng-sessiond.hpp:22,
from utils.cpp:17:
ust-registry.hpp: In constructor 'lttng::sessiond::ust::registry_typed_enum<MappingIntegerType>::registry_typed_enum(const char*, const lttng_ust_ctl_enum_entry*, size_t)':
ust-registry.hpp:111:45: error: 'lttng::sessiond::trace::integer_type::signedness' is not a class, namespace, or enumeration
lttng::sessiond::trace::integer_type::signedness::SIGNED :
^
ust-registry.hpp:112:51: error: 'lttng::sessiond::trace::integer_type::signedness' is not a class, namespace, or enumeration
lttng::sessiond::trace::integer_type::signedness::UNSIGNED),
^
In file included from lttng-sessiond.hpp:22:0,
from utils.cpp:17:
ust-app.hpp: At global scope:
ust-app.hpp:330:13: error: specialization of 'template<class T, class Char, class Enable> struct fmt::v8::formatter' in different namespace [-fpermissive]
struct fmt::formatter<ust_app> : fmt::formatter<std::string> {
^
In file included from ../../../src/common/format.hpp:19:0,
from ust-app.hpp:15,
from lttng-sessiond.hpp:22,
from utils.cpp:17:
../../../src/vendor/fmt/core.h:707:8: error: from definition of 'template<class T, class Char, class Enable> struct fmt::v8::formatter' [-fpermissive]
struct formatter {
^
cc1plus: warning: unrecognized command line option '-Wno-gnu-folding-constant'
cc1plus: warning: unrecognized command line option '-Wno-incomplete-setjmp-declaration'
Makefile:855: recipe for target 'utils.lo' failed
make[3]: *** [utils.lo] Error 1
This also applies to the following specializations:
void lst::signed_enumeration_type::accept(type_visitor& visitor) const
void lst::unsigned_enumeration_type::accept(type_visitor& visitor) const
Problem
=======
This is due to a now-fixed gcc bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480
Solution
========
Put the template specializations inside the proper namespace.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6b931065b37e6e9ba97f87c754c15808506c2ba8
Jérémie Galarneau [Wed, 15 Jun 2022 20:09:05 +0000 (16:09 -0400)]
Build fix: old gcc does not recognize hidden/shadowed enumeration as valid
The build fails on GCC < 6 with:
ust-registry.hpp: In constructor 'lttng::sessiond::ust::registry_typed_enum<MappingIntegerType>::registry_typed_enum(const char*, const lttng_ust_ctl_enum_entry*, size_t)':
ust-registry.hpp:111:45: error: 'lttng::sessiond::trace::integer_type::signedness' is not a class, namespace, or enumeration
lttng::sessiond::trace::integer_type::signedness::SIGNED :
The same error occurs for stream_class::header_type.
This is due to a bug fixed in gcc 6:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60994
In both cases, the member is suffixed to disambiguate the reference to
the inner-enumeration.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id0f2f98a147be589b9c70740660c7fb911dfc22c
Jérémie Galarneau [Wed, 15 Jun 2022 19:00:35 +0000 (15:00 -0400)]
Build fix: unknown warning -Wduplicated-branches
-Wduplicated-branches was introduced in GCC 7. Only define
DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES for those more recent versions.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3b50a671867a74629519375801bf2b4f3c597cd8
Jérémie Galarneau [Tue, 14 Jun 2022 16:11:54 +0000 (12:11 -0400)]
Fix: pthread::mutex unlock must not throw
unlock() is often called by destructors (e.g. lock guard); it must not
throw. We don't expect unlock to fail given our current usage anyhow.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I5dfd856f8a2dd29fd7c480c6ab6289b5b91c4391
Jérémie Galarneau [Tue, 14 Jun 2022 16:04:07 +0000 (12:04 -0400)]
Clean-up: common: uuid: uninitialized output parameter on error
1490018 Uninitialized scalar variable
The variable will contain an arbitrary value left from earlier
computations.
In lttng_uuid_from_str(char const *, std::array<unsigned char, 16ul> &):
Use of an uninitialized variable (CWE-457)
Callers should not use the return parameter anyhow on error.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Idd863d219da840a0c291478733f7b931967a5e56
Jérémie Galarneau [Tue, 14 Jun 2022 16:01:22 +0000 (12:01 -0400)]
Fix: sessiond: registry_channel: initialize _rcu_head and _node
1490020 Uninitialized pointer field
The pointer field will point to an arbitrary memory location, any
attempt to write may cause corruption.
In lttng::sessiond::ust::registry_channel::registry_channel(unsigned int, std::function<void (lttng::sessiond::ust::registry_channel const &)>, std::function<void (lttng::sessiond::ust::registry_channel const &, lttng::sessiond::ust::registry_event const &)>): A pointer field is not initialized in the constructor (CWE-457)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie043af750941a02a65ba69e70fe2620349989398
Jérémie Galarneau [Tue, 14 Jun 2022 15:56:51 +0000 (11:56 -0400)]
sessiond: registry_event: remove lttng_ht_node_u64 wrapper
Use rcu_head and cds_lfht_node directly since the lttng_ht_node_u64
utils is unused anyhow: its key is never initialized.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id8b8d4b2f9ca9137b859844bc70e9d02e9fa2975
Jérémie Galarneau [Tue, 14 Jun 2022 14:56:35 +0000 (10:56 -0400)]
Tests: test_uuid: unchecked return value
1490026 Unchecked return value
If the function returns an error value, the error value may be mistaken
for a normal value.
In run_test_lttng_uuid_is_equal(): Value returned from a function is not
checked for errors before being used (CWE-252)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id9558a07ebcc47f5630deed32f5a457ba002bfe6
Jérémie Galarneau [Tue, 14 Jun 2022 14:54:09 +0000 (10:54 -0400)]
Fix: common: uninitialized lttng::ctl:error field
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I456d1811c3827472533d0531af7148ee6e7eb34b
Jérémie Galarneau [Fri, 10 Jun 2022 19:10:32 +0000 (15:10 -0400)]
common: replace container_of with a C++ safe implementation
As more code moves to a more idiomatic C++ style, structures like
typically end up becoming classes that use different access controls,
virtual functions, etc. This, in turn, makes them adopt a non standard
layout and causes GCC and clang to emit the following warning when
container_of is used:
error: 'offsetof' within non-standard-layout type 'foo' is conditionally-supported [-Werror=invalid-offsetof]
This new implementation of container_of makes use of a pointer to a data
member to find the parent's address.
The use of ptr_to_member against the null dummy_parent makes me uneasy
as it seems equivalent to performing arithmetic on a null pointer, which
I understand is undefined behavior (C++11 Standard 5.7.5).
However, Boost.Instrusive uses an approach that seems roughly equivalent
to lttng::utils::container_of() [1].
It seems like a reasonable compromise that works on all mainstream
compilers.
[1] https://github.com/boostorg/intrusive/blob/
3c5c8cec3f0356a028a4b56ba6cac2256340dab1/include/boost/intrusive/detail/parent_from_member.hpp#L92
Change-Id: Ia6287e1648bce85dfe6de936f17ec5df46ea648d
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 9 Jun 2022 16:16:39 +0000 (12:16 -0400)]
sessiond: registry_session: mark functions as noexcept
Mark functions destroy_channel and _destroy_enum as noexcept as they are
used by the registry_session destructor (which must not throw).
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie7bbbf349f14f5691b52873fe8ba6556be143d93
Jérémie Galarneau [Wed, 8 Jun 2022 19:50:07 +0000 (15:50 -0400)]
Clean-up: sessiond: move registry_session free functions under class
Move a number of registry_session methods implemented as c-style
free functions under the `registry_session` class. This makes it
possible to make a large number of attributes private.
This leaves only the metadata storage and locking facilities
publicly accessible. Making them private requires a bit more
refactoring.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6bdd4cc8918e5d7025fc3d735fadbf1ce2e9b7c8
Jérémie Galarneau [Wed, 8 Jun 2022 17:10:26 +0000 (13:10 -0400)]
Clean-up: sessiond: move ust_registry_session under lttng::sessiond::ust
The ust_registry_session* class hierarchy is namespaced under
lttng::sessiond::ust.
The registry session classes are also moved to their own headers.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3be5aa3239bbff9b385ab942f749748b4d6cb352
Jérémie Galarneau [Mon, 13 Jun 2022 16:01:21 +0000 (12:01 -0400)]
sessiond: transition from lttng-ust to tracer agnostic API
Refactor the session daemon's user space tracer management to use the
tracer-agnostic trace hierarchy description API. Since the API
introduced under lttng::sessiond::trace is closer to idiomatic C++,
some changes are needed to make use of it.
The biggest changes make the ust_registry* structures inherit from the
trace descriptions classes (trace_class, stream_class, event_class,
clock_class). This effectively isolates the members of the
`ust_registry` structures that describe their corresponding CTF class
to a base class and leaves only the implementation guts in the
`ust_registry` objects (moved under lttng::sessiond::ust).
Since the generation of TSDL metadata directly used the lttng_ust_ctl
API, it is replaced by a new implementation that is based around a trace
class visitor that serializes the tracer agnostic trace description
objects.
The TSDL environment visitor is moved under the TSDL implementation
of the trace class visitor.
Some little changes are also made to the existing code to make it
exception-safe, as needed.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6562ef12e85afa91780337e8c6fdbb13568d9ece
Jérémie Galarneau [Thu, 12 May 2022 18:34:30 +0000 (14:34 -0400)]
sessiond: add tracer-agnostic trace hierarchy classes
The session daemon receives the fields present in events from the
instrumented applications in the form of an array of lttng_ust_ctl_field
structures and uses them directly in a number of code paths.
This makes it impossible to extend the structures which makes a number of
features harder to implement than they should be.
The session daemon also implements various CTF concepts (clock, trace,
event, stream classes) as part of various structures defined under
`ust_registry*`. This makes it hard to isolate which attributes are
"internal" and which are visible to the external world through the
traces.
Tracer-agnostic trace hierachy classes are introduced under the
lttng::sessiond::trace namespace. Those classes don't cover the full
functionality of CTF: they expose what the tracers can currently
express.
The top-level elements of the trace hierarchy -- trace, event, stream,
clock classes -- are visited using the trace_class_visitor interface.
Seperate field and type visitor interfaces are used to make it easier to
visit this subset of the trace hierarchy. This will be useful to
implement the listing of event fields through liblttng-ctl, for example.
In the short term, these classes will be used to implement the
serialization of the layout descriptions of CTF 1.8 and 2.
Change-Id: I6d99f0ec93082259bf64434c440a720ed9a49bf8
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 2 Jun 2022 15:01:23 +0000 (11:01 -0400)]
common: macros: missing include of pthread.h
A number of macros in this file make use of pthread APIs. However, the
header is not included.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If13df2434bd08269984c9589ff60a2bae4484ab3
Jérémie Galarneau [Thu, 2 Jun 2022 15:00:40 +0000 (11:00 -0400)]
common: uuid: add `uuid_to_str` which returns an std::string
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id915ba7dbe8128d492d92faa05bbf12770a49f8d
Jérémie Galarneau [Thu, 12 May 2022 19:22:50 +0000 (15:22 -0400)]
sessiond: session registry: use pthread::lock_guard instead of raw lock
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3f5227782701a82257b710232fc02bd3c61a2e20
Jérémie Galarneau [Mon, 16 May 2022 22:49:05 +0000 (18:49 -0400)]
Tests fix: metadata event: print expected and actual event match count
The validate_metadata_event() function prints the actual event match
count twice when a test fails. Printing the expected vs actual counts
was probably the intention of the original author.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ideac2593a5d4d239ee24f98f954dddf2b5be91fa
Jérémie Galarneau [Mon, 16 May 2022 21:50:08 +0000 (17:50 -0400)]
Add lttng::locked_reference
A locked reference is a wrapper that allows functions to return a
protected/synchronized version of an object. My immediate use-case for
this helper is making it easier to call functions that return an
rcu-protected object (require the caller to hold the RCU reader lock for
the duration of its use of that object) in an exception safe manner.
As such, these functions can now return
lttng::locked_reference<MyType, lttng::urcu::unique_read_lock> which
ensures the RCU reader lock is held for as long as the object is used.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9f4b7f918ba01491d3de14a1a570c83586f407ae
Jérémie Galarneau [Wed, 25 May 2022 19:26:31 +0000 (15:26 -0400)]
sessiond: ust: remove unused `is_sent` attribute of ust_app_channel
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If97146367f62edf739d1228908c21346c2dae231
Jérémie Galarneau [Thu, 12 May 2022 18:32:32 +0000 (14:32 -0400)]
format: add a custom formatter for std::type_info
The name() returned by std::type_info is implementation-dependant. In
practice, it is typically the type's mangled name. For GCC and clang, it
is possible to use abi::__cxa_demangle to demangle the name at runtime
while formatting a string.
If this poses any compatibility problem on other platforms, we can
fallback to using name() directly.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib80babe4039c91ce6fdf6d9a9442c31645a43b08
Jérémie Galarneau [Thu, 12 May 2022 18:29:25 +0000 (14:29 -0400)]
common: add macros to silence invalid offsetof warnings
Implementations are not forced to support offsetof for non-trivial types
in C++. gcc and clang both appear to support its use, but we should move
away from that. unfortunately that is not easy since offsetof is used
all over the place to use intrusive data structures.
I am unsure of the proper fix for this at the moment.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6f2cedb0da235ff3756248f370add13d46438cec
Jérémie Galarneau [Thu, 12 May 2022 18:27:06 +0000 (14:27 -0400)]
Add new exception types: communication, protocol, and invalid argument
These new exception types are useful to expess communication errors
and are used in later patches when an application doesn't honor the
liblttng-ust-ctl protocol.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If5cd92c2f2fc31c6e68d49ade9e66f16e50394a3
Jérémie Galarneau [Thu, 12 May 2022 18:24:07 +0000 (14:24 -0400)]
Add lttng::make_unique
Add an equivalent to std::make_unique introduced in C++14.
See https://herbsutter.com/gotw/_102/ for more details.
Change-Id: I67e5b54d883e311869d7c1272f9a2905dc349212
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 5 May 2022 20:12:45 +0000 (16:12 -0400)]
consumerd: Rename global ctx variable to the_consumer_context
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iba386af30616ac193106cb36a4ad0e9b03fb02de
This page took 0.05741 seconds and 4 git commands to generate.