lttng-tools.git
3 years agocondition: buffer usage: validation does not check for ratio and bytes threshold
Jonathan Rajotte [Thu, 4 Feb 2021 20:46:27 +0000 (15:46 -0500)] 
condition: buffer usage: validation does not check for ratio and bytes threshold

Buffer usage condition do not support having both ratio and bytes
threshold set.

Using `!usage->threshold_ratio.set && !usage->threshold_bytes.set` does
not error out for `threshold_ratio.set == 1` and
`usage->threshold_bytes.set == 1`

0 0 : 1
0 1 : 0
1 0 : 0
1 1 : 0

We want to check for a xnor (`usage->threshold_ratio.set == usage->threshold_bytes.set`)

0 0 : 1
0 1 : 0
1 0 : 0
1 1 : 1

We could also do 2 error check one for not set and one validating that
both are not set.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I5bfcf43bcaf9687ddf9fdebe5ace4f15bda28261

3 years agoRemove LTTNG_EVENT_RULE_TYPE_KERNEL_FUNCTION
Jonathan Rajotte [Tue, 18 May 2021 18:57:05 +0000 (14:57 -0400)] 
Remove LTTNG_EVENT_RULE_TYPE_KERNEL_FUNCTION

It is not supported for 2.13.

Change-Id: If42b18115cc61da9ee17f281390280b21fdc35a6
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoRemove lttng_event_rule_tracepoint
Jonathan Rajotte [Wed, 12 May 2021 07:20:51 +0000 (03:20 -0400)] 
Remove lttng_event_rule_tracepoint

lttng_event_rule_tracepoint is "exploded" in:
   lttng_event_rule_user_tracepoint
   lttng_event_rule_kernel_tracepoint
   lttng_event_rule_jul_logging
   lttng_event_rule_python_logging
   lttng_event_rule_log4j_logging

On the CLI front, the `--domain` option for the add-trigger is removed
since for each event rule type the domain is implicit based on the type.

`--type` accepts the following:
   kernel
   kernel:tracepoint
   kernel:kprobe
   kernel:uprobe
   syscall
     syscall:entry
     syscall:exit
     syscall:entry+exit
     syscall:*
   kernel:syscall
     kernel:syscall:entry
     kernel:syscall:exit
     kernel:syscall:entry+exit
     kernel:syscall:*
   user
   user:tracepoint
   python
   python:logging
   jul
   jul:logging
   log4j
   log4j:logging
   kprobe
   function

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4a0489f8f2a79a2c967f5d69461bed10f40b8278

3 years agoTest log level for newly introduced event rule type (*_logging, user_tracepoint)
Jonathan Rajotte [Wed, 12 May 2021 05:35:53 +0000 (01:35 -0400)] 
Test log level for newly introduced event rule type (*_logging, user_tracepoint)

This is in prevision to lttng_event_rule_tracepoint removal.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iff251d7540a16a2a9561d834fc464ac1a6be4f84

3 years agoIntroduce lttng_event_rule_python_logging
Jonathan Rajotte [Wed, 12 May 2021 05:10:41 +0000 (01:10 -0400)] 
Introduce lttng_event_rule_python_logging

A following patch will remove lttng_event_rule_tracepoint.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I222bd4f2616efd1b0c0e36cfe5a89cf5416b6a88

3 years agoIntroduce lttng_event_rule_log4j_logging
Jonathan Rajotte [Wed, 12 May 2021 05:01:19 +0000 (01:01 -0400)] 
Introduce lttng_event_rule_log4j_logging

A following patch will remove lttng_event_rule_tracepoint.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie94c172ed9550dd7c3ae9967e353a3d6ac5b5907

3 years agoIntroduce lttng_event_rule_jul_logging
Jonathan Rajotte [Wed, 12 May 2021 03:38:17 +0000 (23:38 -0400)] 
Introduce lttng_event_rule_jul_logging

A following patch will remove lttng_event_rule_tracepoint.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I95f40920b73b5deb42c2e92ad50c43dba0b0e436

3 years agoIntroduce lttng_event_rule_user_tracepoint
Jonathan Rajotte [Wed, 12 May 2021 00:16:51 +0000 (20:16 -0400)] 
Introduce lttng_event_rule_user_tracepoint

A following patch will remove lttng_event_rule_tracepoint.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If814c3ba828e4869cde9af4b9d76c8b830f30654

3 years agoIntroduce lttng_event_rule_kernel_tracepoint
Jonathan Rajotte [Tue, 11 May 2021 23:52:37 +0000 (19:52 -0400)] 
Introduce lttng_event_rule_kernel_tracepoint

A following patch will remove lttng_event_rule_tracepoint.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I614e45be3ef5e41fa081ad24dc1a9dcddb7eb2af

3 years agoRename lttng_event_rule_kernel_probe to lttng_event_rule_kernel_kprobe
Jonathan Rajotte [Tue, 18 May 2021 18:48:37 +0000 (14:48 -0400)] 
Rename lttng_event_rule_kernel_probe to lttng_event_rule_kernel_kprobe

The add trigger command now accepts `kernel:kprobe` instead of `kernel-
probe`. `kprobe` is still accepted.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ifd6753f337e93ea8eb393b8d686596112292c5bb

3 years agoRename lttng_event_rule_userspace_probe to lttng_event_rule_kernel_uprobe
Jonathan Rajotte [Tue, 18 May 2021 17:44:38 +0000 (13:44 -0400)] 
Rename lttng_event_rule_userspace_probe to lttng_event_rule_kernel_uprobe

The `--type` option for add trigger now only support `kernel:uprobe`.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2c4de8e314d6fba735343d21c04fff366b92cca9

3 years agoRename lttng_event_rule_syscall to lttng_event_rule_kernel_syscall
Jonathan Rajotte [Tue, 18 May 2021 16:08:15 +0000 (12:08 -0400)] 
Rename lttng_event_rule_syscall to lttng_event_rule_kernel_syscall

Allow the usage of "kernel:syscall*" as the `--type` argument for add
trigger. A later patch remove the notion of domain.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib5c87ec937bb0acf9c5133532961dcc31e533884

3 years agoRename *emission_site_type to *emission_site
Jonathan Rajotte [Tue, 11 May 2021 23:19:03 +0000 (19:19 -0400)] 
Rename *emission_site_type to *emission_site

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3027affe23de8674a5a813d18643396e3a1474f1

3 years agoRename lttng_event_rule_syscall_(set, get)_pattern to lttng_event_rule_syscall_(set...
Jonathan Rajotte [Tue, 11 May 2021 23:02:45 +0000 (19:02 -0400)] 
Rename lttng_event_rule_syscall_(set, get)_pattern to lttng_event_rule_syscall_(set, get)_name_pattern

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia6d8c55f607cd5af4201a61abaab277994618bb6

3 years agoRename *exclusion* to *name_pattern_exclusion*
Jonathan Rajotte [Tue, 11 May 2021 22:58:05 +0000 (18:58 -0400)] 
Rename *exclusion* to *name_pattern_exclusion*

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ic72582dccdc2810dfc07fc66abf776c853d217b6

3 years agoRename lttng_event_rule_tracepoint_(set,get)_pattern to lttng_event_rule_tracepoint_...
Jonathan Rajotte [Tue, 11 May 2021 22:47:31 +0000 (18:47 -0400)] 
Rename lttng_event_rule_tracepoint_(set,get)_pattern to lttng_event_rule_tracepoint_(set, get)_name_pattern

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib018d7ab4fab66842302beef19c0971d704d2d02

3 years agoBuild fix: cygwin: unknown type ssize_t
Jérémie Galarneau [Fri, 28 May 2021 15:36:34 +0000 (11:36 -0400)] 
Build fix: cygwin: unknown type ssize_t

The build fails on cygwin with the following error:

  In file included from actions/path.c:8:
  ../../include/lttng/action/path-internal.h:31:1: error: unknown type name "ssize_t"; did you mean "_ssize_t"?

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I93aac8ef33cfe19b655d80709c9b95a503815bda

3 years agoFix: consumer: unbalanced RCU read-side lock on error
Mathieu Desnoyers [Thu, 27 May 2021 20:45:55 +0000 (16:45 -0400)] 
Fix: consumer: unbalanced RCU read-side lock on error

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I22ddc8585af84d07e8f3d19e9df582599352a1b8

3 years agolttng-enable-event(1): add usage examples
Philippe Proulx [Tue, 25 May 2021 18:56:54 +0000 (14:56 -0400)] 
lttng-enable-event(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6310d753a2fd6db74f4a854a87cda690d3479593

3 years agolttng-{enable,disable}-event(1): document default channel limitation
Philippe Proulx [Tue, 25 May 2021 18:56:15 +0000 (14:56 -0400)] 
lttng-{enable,disable}-event(1): document default channel limitation

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I0b531be8bde9dfd74bb4a28fe70eeef5eeee7f72

3 years agodoc/man: log level prefixes are not required
Philippe Proulx [Tue, 18 May 2021 16:36:29 +0000 (12:36 -0400)] 
doc/man: log level prefixes are not required

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iddd9eaff96ca857b1249421c31b64bec859429c6

3 years agoFix: sessiond: use of uninitialized memory in buffer-usage condition
Francis Deslauriers [Tue, 25 May 2021 21:45:57 +0000 (17:45 -0400)] 
Fix: sessiond: use of uninitialized memory in buffer-usage condition

Issue
=====

valgrind reports the following:
  ==436327== Thread 9 Client manageme:
  ==436327== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s)
  ==436327==    at 0x51E418D: __libc_sendmsg (sendmsg.c:28)
  ==436327==    by 0x51E418D: sendmsg (sendmsg.c:25)
  ==436327==    by 0x20D436: lttcomm_send_unix_sock (unix.c:294)
  ==436327==    by 0x186F08: send_unix_sock (client.c:895)
  ==436327==    by 0x18BAFA: thread_manage_clients (client.c:2800)
  ==436327==    by 0x18147D: launch_thread (thread.c:66)
  ==436327==    by 0x51D8608: start_thread (pthread_create.c:477)
  ==436327==    by 0x5314292: clone (clone.S:95)
  ==436327==  Address 0x7540ec1 is 97 bytes inside a block of size 256 alloc'd
  ==436327==    at 0x483DFAF: realloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==436327==    by 0x1E7556: lttng_dynamic_buffer_set_capacity (dynamic-buffer.c:166)
  ==436327==    by 0x1E72FC: lttng_dynamic_buffer_append (dynamic-buffer.c:55)
  ==436327==    by 0x1DE604: lttng_condition_buffer_usage_serialize (buffer-usage.c:123)
  ==436327==    by 0x1DFF47: lttng_condition_serialize (condition.c:98)
  ==436327==    by 0x20ACD0: lttng_trigger_serialize (trigger.c:328)
  ==436327==    by 0x189EBE: process_client_msg (client.c:2258)
  ==436327==    by 0x18B761: thread_manage_clients (client.c:2742)
  ==436327==    by 0x18147D: launch_thread (thread.c:66)
  ==436327==    by 0x51D8608: start_thread (pthread_create.c:477)
  ==436327==    by 0x5314292: clone (clone.S:95)

This can be reproduce by running the sessiond under valgrind and
launching the following binary to register buffer-usage conditions:
  ./tests/regression/tools/trigger/utils/register-some-triggers test_buffer_usage_conditions

The valgrind report is pointing us toward the `struct
lttng_condition_buffer_usage_comm` stack allocation in the
`lttng_condition_buffer_usage_serialize()` function.

The actual issue is that the threshold_bytes/threshold_ratio will not be
initialized in that structure depending on the way the threshold is
expressed.

Fix
===

Make sure the struct is zeroed at the declaration site.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2046f4e0e1d857cfd1a53e0c13aea55f17adada3

3 years agolttng-ctl: use lttng_action_path to specify error query actions
Jérémie Galarneau [Tue, 25 May 2021 23:17:07 +0000 (19:17 -0400)] 
lttng-ctl: use lttng_action_path to specify error query actions

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I30a93465231ec963d087b25678b6703a0425ceef

3 years agoerror-query: add lttng_action_path to express the location of an action
Jérémie Galarneau [Thu, 20 May 2021 22:50:06 +0000 (18:50 -0400)] 
error-query: add lttng_action_path to express the location of an action

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Icc3056029219cc8f0794b06e7021885e193724be

3 years agotests: Move tap-driver.sh out of the autotools aux directory
Michael Jeanson [Tue, 11 May 2021 14:29:50 +0000 (10:29 -0400)] 
tests: Move tap-driver.sh out of the autotools aux directory

We have made local modifications to this script, move it to the test
suite directory so it doesn't get overwritten by an updated version from
autotools.

Running 'make check' on current RHEL or Fedora without this patch
results in the following error:

  make[5]: Entering directory '/builddir/build/BUILD/lttng-tools-2.12.4/tests/regression'
  tap-driver.sh: invalid option: '--post-script'

Change-Id: I22823176cc5b98901865c9415250ce8e49384cbd
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agolttng-enable-channel(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 21:39:12 +0000 (17:39 -0400)] 
lttng-enable-channel(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I26bcfed2b6d71b0bbc2fa89d33f37925c303c91c

3 years agolttng-view(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 20:23:59 +0000 (16:23 -0400)] 
lttng-view(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9324b0733ebbaabb824efca4a11330fe3a5c1d0f

3 years agolttng-untrack(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 20:20:08 +0000 (16:20 -0400)] 
lttng-untrack(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ibafe1662e37110962ae3c7fdef9d450b75f2c0a5

3 years agolttng-untrack(1): follow the style of lttng-track(1) for the example
Philippe Proulx [Mon, 17 May 2021 20:19:49 +0000 (16:19 -0400)] 
lttng-untrack(1): follow the style of lttng-track(1) for the example

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I0c714eb2e504d118cfb3b48bf8e70f33d36d2352

3 years agolttng-track(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 20:19:09 +0000 (16:19 -0400)] 
lttng-track(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I21a7906626a09b9964fc51dd083f1c2ea5b855c3

3 years agolttng-stop(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 20:05:40 +0000 (16:05 -0400)] 
lttng-stop(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6794937457d4f34d649b9edb6a755e091a6af67e

3 years agolttng-start(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 20:05:30 +0000 (16:05 -0400)] 
lttng-start(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I893a9e26ac69269150cf0a68ec6968cb5fa9bdbf

3 years agolttng-snapshot(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 20:01:05 +0000 (16:01 -0400)] 
lttng-snapshot(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I686f3c8a0e82952a5b673780eef830dea888044d

3 years agolttng-save(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 19:49:59 +0000 (15:49 -0400)] 
lttng-save(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I73d4cd169c37d0dbb99ad965d04acc9eaf8a1856

3 years agolttng-rotate(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 19:46:22 +0000 (15:46 -0400)] 
lttng-rotate(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2ee1a32fd44b6abf6a8d58749f1a42731b30ba56

3 years agolttng-remove-trigger(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 19:44:06 +0000 (15:44 -0400)] 
lttng-remove-trigger(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ic34f148f061999b90ad47df8efc5c1db2d07f762

3 years agolttng-regenerate(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 19:35:42 +0000 (15:35 -0400)] 
lttng-regenerate(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I91074dfc717d481fe16ec4f40533757a0b3f3da4

3 years agolttng-load(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:29:07 +0000 (14:29 -0400)] 
lttng-load(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1a4902b1325630c79b8ec121e95874bca1ca8bd6

3 years agolttng-list(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:21:06 +0000 (14:21 -0400)] 
lttng-list(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id52a51f4daeef2266885d25240699ee921bb041b

3 years agolttng-enable-rotation(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:12:16 +0000 (14:12 -0400)] 
lttng-enable-rotation(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I56eafd9e52cd37f48849ddfb82d007c9fb3f3767

3 years agolttng-disable-rotation(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:09:54 +0000 (14:09 -0400)] 
lttng-disable-rotation(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I24f132858c12fa4e99b8a24baee9e8becf0d73f8

3 years agolttng-disable-event(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:05:02 +0000 (14:05 -0400)] 
lttng-disable-event(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I111fbfca2a12517ea6b2f315f4adf0c1b60c37de

3 years agolttng-disable-channel(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:04:53 +0000 (14:04 -0400)] 
lttng-disable-channel(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia524f1e3f032633670312000f4fc5674c09da498

3 years agolttng-destroy(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:04:43 +0000 (14:04 -0400)] 
lttng-destroy(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If16dcd4197c6af734b1147c9463ae2255b0a1c1f

3 years agolttng-create(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:04:31 +0000 (14:04 -0400)] 
lttng-create(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2371a84eac9310b6725462ea4278d01497c3e7f4

3 years agolttng-clear(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:04:21 +0000 (14:04 -0400)] 
lttng-clear(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id410c79fddb88de87edda333bec9ef59b6f5afc9

3 years agolttng-add-trigger(1): DESCRIPTION: move up the link to "EXAMPLES"
Philippe Proulx [Mon, 17 May 2021 18:02:45 +0000 (14:02 -0400)] 
lttng-add-trigger(1): DESCRIPTION: move up the link to "EXAMPLES"

In lttng(1) manual pages, put

    See the <<examples,EXAMPLES>> section below for usage examples.

above references to other manual pages at the bottom of the
"DESCRIPTION" section.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I498a49536d6a876af9a0ed009378d257e483c975

3 years agolttng-add-context(1): EXAMPLES: add internal links to relevant options
Philippe Proulx [Mon, 17 May 2021 18:02:15 +0000 (14:02 -0400)] 
lttng-add-context(1): EXAMPLES: add internal links to relevant options

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I242445993ae85c66074b90078dcd1f8e18cb86db

3 years agolttng-disable-event(1): `--tracepoint` option is not the default
Philippe Proulx [Mon, 17 May 2021 17:57:48 +0000 (13:57 -0400)] 
lttng-disable-event(1): `--tracepoint` option is not the default

I previously thought that not specifying any instrumentation point type
option was equivalent to specifying `--tracepoint`, like with the
`enable-event` command.

It's not the case: `--tracepoint` is just a filter, like `--syscall` and
the others. With `--kernel`, if you don't specify any instrumentation
point type condition option, the `disable-event` command disables
recording event rules regardless of their instrumentation point type.

This patch updates lttng-disable-event(1) to explain this.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I489c5d16dae954f4b5116edce556fdd942c98c4d

3 years agoCleanup: tests: name all temporary files to better identify leakage
Francis Deslauriers [Fri, 14 May 2021 20:04:28 +0000 (16:04 -0400)] 
Cleanup: tests: name all temporary files to better identify leakage

When using a template, we need to add `--tmpdir` to the `mktemp`
arguments to place the tmp files in `/tmp` or `$TMPDIR`.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id107530578d91700b726ceec016a8cef772e94b0

3 years agoCleanup: tests: use find's `-name` option instead of grep
Francis Deslauriers [Mon, 17 May 2021 19:01:33 +0000 (15:01 -0400)] 
Cleanup: tests: use find's `-name` option instead of grep

This prevents grep of finding matches in the leading directories listed
by find.

It caused problem when I used the "metadata" string in one of the
directory names:
  /tmp/tmp.test_regen_metadata_ust_trace_path.6FbwPF/

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I7165a3b4e4a16c793fe51c40484978be3a99dbfc

3 years agoUpdate version to v2.13.0-rc2
Jérémie Galarneau [Sat, 15 May 2021 03:32:57 +0000 (23:32 -0400)] 
Update version to v2.13.0-rc2

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: expected procname should not have -ust suffix
Mathieu Desnoyers [Sat, 15 May 2021 00:57:33 +0000 (20:57 -0400)] 
Fix: expected procname should not have -ust suffix

commit ("Fix: ustcomm: application name uses the '-ust'-suffixed thread
name") in LTTng-UST removes "-ust" suffix from procname, which appears
in the output trace directory hierarchy.

Adapt tests to not expect this quirk.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I96c3944124bbe154875085a37a51ba2bd458f83b

3 years agoFix: Tests: leftover temporary files after tests
Francis Deslauriers [Fri, 14 May 2021 19:45:15 +0000 (15:45 -0400)] 
Fix: Tests: leftover temporary files after tests

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie0c66d45a00e890c1f1e8dc8db7b1baa2cca50f1

3 years agoFix: trigger: abort() when adding `--notify` action with python event rule matches
Francis Deslauriers [Wed, 12 May 2021 15:28:26 +0000 (11:28 -0400)] 
Fix: trigger: abort() when adding `--notify` action with python event rule matches

Issue
=====
Adding the following trigger makes the sessiond abort:
  lttng add-trigger --condition=event-rule-matches --domain=python --action=notify

With the following stacktrace:
  (gdb) bt
  #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
  #1  0x00007ffff7a71859 in __GI_abort () at abort.c:79
  #2  0x00000000004a1eeb in event_notifier_error_accounting_register_event_notifier (trigger=0x7fffe0000f50, error_counter_index=0x7fffefffde38) at event-notifier-error-accounting.c:1075
  #3  0x00000000004743e6 in setup_tracer_notifier (state=0x7fffefffe3e8, trigger=0x7fffe0000f50) at notification-thread-events.c:2606
  #4  0x000000000046dacb in handle_notification_thread_command_register_trigger (state=0x7fffefffe3e8, trigger=0x7fffe0000f50, is_trigger_anonymous=false, cmd_result=0x7fffedfdd6e8) at notification-thread-events.c:2751
  #5  0x000000000046d083 in handle_notification_thread_command (handle=0x601460, state=0x7fffefffe3e8) at notification-thread-events.c:3112
  #6  0x00000000004687bd in thread_notification (data=0x601460) at notification-thread.c:710
  #7  0x0000000000486703 in launch_thread (data=0x601550) at thread.c:66
  #8  0x00007ffff7c47609 in start_thread (arg=<optimized out>) at pthread_create.c:477
  #9  0x00007ffff7b6e293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

This happens because the LTTNG_DOMAIN_PYTHON domain is not handled by
the switch-case.

Fix
===
Add LTTNG_DOMAIN_PYTHON (all other agent domains) as a fallthrough
LTTNG_DOMAIN_UST.

Note
====
Add a basic test case for python agent.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9971cdad8bbc6adca8f6ba49964483c42a25be7d

3 years agoTests: move `list_triggers_matches_ok` to utils.sh
Francis Deslauriers [Wed, 12 May 2021 15:09:37 +0000 (11:09 -0400)] 
Tests: move `list_triggers_matches_ok` to utils.sh

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4cd3816fa7cbc1032582b2a99f67a3b14222f972

3 years agoTests: Move python test app to `tests/utils/testapp` directory
Francis Deslauriers [Thu, 13 May 2021 01:21:28 +0000 (21:21 -0400)] 
Tests: Move python test app to `tests/utils/testapp` directory

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9bc55c0fc0b8de42157d64884c7e1ee08b800525

3 years agoFix: validate whether event notifiers are supported by UST application
Mathieu Desnoyers [Wed, 12 May 2021 20:05:29 +0000 (16:05 -0400)] 
Fix: validate whether event notifiers are supported by UST application

Considering that lttng-sessiond interacts with older (2.12) applications
as well as 2.13+, it needs not to send event notifiers related commands
to an older UST, because the unknown command will cause the protocol to
become out of sync on the communication socket, because the older
lttng-ust does not know how many bytes must be read when receiving the
unknown command. So even though it can return that the command is
unknown, the communication socket becomes out of sync.

Depends-on: lttng-ust: If048c739dd37147ffb2a54715c2101177d2df4f7
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If9cbc7a7cd6cb957134bf3a2e284ab99ef20e93b

3 years agoFix: ust: keep using lttng-ust-sock-8 and lttng-ust-wait-8 filenames
Mathieu Desnoyers [Wed, 12 May 2021 18:09:00 +0000 (14:09 -0400)] 
Fix: ust: keep using lttng-ust-sock-8 and lttng-ust-wait-8 filenames

Replicate a change from a lttng-ust header for which there is an
internal copy within lttng-tools for building without lttng-ust.

lttng-ust commit 6a359b8a4006 ("Bump LTTNG_UST_ABI version from 8.1 to
9.0") attempted to ensure that a session daemon linked against an old
lttng-ust-ctl (2.12) would not attempt to interact with newer
applications.

This was done by increasing the major ABI version number, but
introducing LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE (set to 8) as
a mean to allow session daemon to accept both major versions 8 and 9.

Unfortunately, changing LTTNG_UST_ABI_MAJOR_VERSION means the filenames
used for communication changed as well, meaning that applications linked
against older lttng-ust 2.12 cannot interact with lttng sessiond linked
against lttng-ust-ctl 2.13, which is unintended.

Therefore, go back to using the previous filenames: lttng-ust-sock-8,
and lttng-ust-wait-8 for communication.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I121c6e5aa13637f13b996dd9e31e06d060b52ca6

3 years agoFix: Handle SIGBUS in sessiond and consumerd
Mathieu Desnoyers [Wed, 7 Oct 2020 20:42:05 +0000 (16:42 -0400)] 
Fix: Handle SIGBUS in sessiond and consumerd

There is an issue with the security model of lib ring buffer (lttng-ust)
vs SIGBUS handling by consumer daemon. We do not handle SIGBUS in the
consumer daemon. An application using ftruncate on a ring buffer shm
could cause the consumer to be killed with SIGBUS.

Wire up SIGBUS handling in the session daemon as well given that it also
uses liblttng-ust-ctl.

This depends on "liblttng-ust-ctl: Implement SIGBUS handling" in
lttng-ust, which extends the API of liblttng-ust-ctl, which requires
the user application to define the TLS sigbus state with
DEFINE_LTTNG_UST_SIGBUS_STATE(). It therefore needs to be introduced in
locked-step between lttng-ust and lttng-tools.

Considering that this change in liblttng-ust-ctl modifies the ABI, it is
done with a major soname version bump of the library, so it is allowed
to break the API.

Depends-on: lttng-ust: I7ade988e3e68a87930fbcee3e14e59c3fb66e755

Fixes: #1284
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I76a91616bd35b21c5e891c8306c73ed5e8725ebb

3 years agoClean-up: rename double 'lttng' prefixed functions
Jérémie Galarneau [Thu, 13 May 2021 19:45:43 +0000 (15:45 -0400)] 
Clean-up: rename double 'lttng' prefixed functions

Rename `lttng_lttng_ust_ctl_flush_buffer` to `lttng_ust_flush_buffer`
since the double prefix is odd, but needed to work-around a clash
with symbols introduced in liblttng-ust-ctl as part of 2.13.

Two functions stubs are not used are removed:
  - lttng_lttng_ust_ctl_get_mmap_read_offset,
  - lttng_lttng_ust_ctl_get_mmap_base.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9a924f503c7d409ed1a28768d07cbbad9d23f503

3 years agolttng-{enable-event(1),event-rule(7)}: `--filter` is not always avail.
Philippe Proulx [Thu, 13 May 2021 02:59:59 +0000 (22:59 -0400)] 
lttng-{enable-event(1),event-rule(7)}: `--filter` is not always avail.

The `--filter` option of both lttng-enable-event(1) and a common event
rule specification is not available with the Linux kprobe, kretprobe,
and user space probe instrumentation point types.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2cea488359bbe8ac8494d785fe3282419ee66d46

3 years agolttng(1)/lttng-create(1): document `--relayd-path`
Philippe Proulx [Thu, 13 May 2021 02:52:25 +0000 (22:52 -0400)] 
lttng(1)/lttng-create(1): document `--relayd-path`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I83d65e13834593c97e296db2505dc97f6a8e4568

3 years agodoc/man: document `LTTNG_SESSIOND_PATH` env. var. like `--sessiond-path`
Philippe Proulx [Thu, 13 May 2021 02:51:41 +0000 (22:51 -0400)] 
doc/man: document `LTTNG_SESSIOND_PATH` env. var. like `--sessiond-path`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie6ff3f2f1003d506e5d4a351af0f811b4ca8b556

3 years agolttng-save(1): document `--all` option in "SYNOPSIS" and "DESCRIPTION"
Philippe Proulx [Thu, 13 May 2021 02:24:09 +0000 (22:24 -0400)] 
lttng-save(1): document `--all` option in "SYNOPSIS" and "DESCRIPTION"

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I895e2c8277cb8c1b7644f6d8607cd77230706515

3 years agoFix: snapshot path have domain subdir duplicate "ust/ust" or "kernel/kernel"
Jonathan Rajotte [Tue, 1 Dec 2020 17:19:53 +0000 (12:19 -0500)] 
Fix: snapshot path have domain subdir duplicate "ust/ust" or "kernel/kernel"

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

lttng-ivc observed unexpected path generated for streamed snapshot:

  joraj-alpa/
   test-20190319-120000-20210113-110101/
    snapshot-1-20210113-110102-0/
*     ust/
*      ust/
        pid/
         app-ust-2362198-20210113-110101/
           channel_0
           channel_1
           metadata
           channel_2
           channel_3

"ust" the domain subdir is present two-time instead off only one time.

The same problem is seen for kernel snapshots.

Cause
=====

Based on dissection the problem was introduced by commit
5da88b0f58d7f838068037ea449ddfb25d3e85ad [1]

For snapshots, the consumer output object of the snapshot output and
information is fetched from the *original* consumer output.
(code block around src/bin/lttng-sessiond/cmd.c:4748)

The snapshot consumer output does not contains the necessary information
to populate domain_subdir on copy (domain_subdir is '\0').

This would lead to a len evaluation of 1 for the consumer_path_offset in
setup_channel_trace_path:70. This would end up not "skipping" the "ust"
and "kernel" part of the path.

Solution
========

Part of the solution is to copy the domain_subdir from the original
session consumer output to the snapshot output.

Still, the problem was still present since that now that the
domain_subdir was not "\0", the value was suffixed to the passed
session_path. In the snapshot code path, "ust/" and "kernel/" were
already present in the session_path passed to setup_channel_trace_path.

A quick modification at the caller level in the snapshot code path fixes
the issues once and for all.

Tests
=======

The test suit is augmented for certain key tests to validate the
complete path of a trace.

Path validation is based on crude bash pattern matching.

Known drawbacks
=========
None

References
==========
[1] https://github.com/lttng/lttng-tools/commit/5da88b0f58d7f838068037ea449ddfb25d3e85ad

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie7cd2d5471ee3a942fa511e2f4cab09e3aa499e4

3 years agoFix: error: remove trailing period from error descriptions
Jérémie Galarneau [Tue, 11 May 2021 18:37:02 +0000 (14:37 -0400)] 
Fix: error: remove trailing period from error descriptions

Trailing periods in some error descriptions cause the client to print
two dots at the end of some error messages:

Error: Failed to register trigger: Tracing the kernel requires a root
lttng-sessiond daemon, as well as "tracing" group membership or root
user ID for the lttng client..

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib6522252fb716b1baad3c7416e2db150c614702c

3 years agoMake the subitems array a part of action_work_item
Jérémie Galarneau [Mon, 10 May 2021 19:02:51 +0000 (15:02 -0400)] 
Make the subitems array a part of action_work_item

Make the subitems array a part of action_work_item instead of allocating
it dynamically when a trigger is enqueued for a given action executor.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I474e43ba3ba9267d629d3ce561c8677c90bddf27

3 years agoTest: fix: firing policy name has changed
Jérémie Galarneau [Tue, 11 May 2021 19:52:50 +0000 (15:52 -0400)] 
Test: fix: firing policy name has changed

The firing policy name from "after every" to "every" in 4edabba83. The
tests are adapted to reflect this change.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ic563c8ce959a6876e1300079ed236c83072efc58

3 years agolttng-add-trigger(1): add usage examples
Philippe Proulx [Thu, 6 May 2021 20:50:28 +0000 (16:50 -0400)] 
lttng-add-trigger(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iac386141968106e648da67498696ecba9524491e

3 years agolttng-add-context(1): add usage examples
Philippe Proulx [Thu, 6 May 2021 20:50:17 +0000 (16:50 -0400)] 
lttng-add-context(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8ce928325a659676210ea9d2647ce7223f9527aa

3 years agolist_triggers.c: replace "after every" -> "every"
Philippe Proulx [Thu, 6 May 2021 20:19:39 +0000 (16:19 -0400)] 
list_triggers.c: replace "after every" -> "every"

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If6121fda5bb6d7cf5c941c1ca134191c72518422

3 years agoFix: add_trigger.c: `goto error` with a wrong UID for `--owner-uid`
Philippe Proulx [Thu, 6 May 2021 20:10:01 +0000 (16:10 -0400)] 
Fix: add_trigger.c: `goto error` with a wrong UID for `--owner-uid`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8650af1f43e8ed8bad58a928cfcdf78d382212f1

3 years agolttng-add-context(1): use a description list to explain `--channel`
Philippe Proulx [Thu, 6 May 2021 19:15:29 +0000 (15:15 -0400)] 
lttng-add-context(1): use a description list to explain `--channel`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie2d701820bf1e086205254c0712fe088c3295b2d

3 years agodoc/man/manpage.xsl: indent the body of formal (example) blocks
Philippe Proulx [Thu, 6 May 2021 19:09:58 +0000 (15:09 -0400)] 
doc/man/manpage.xsl: indent the body of formal (example) blocks

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I184b1bc54728cf0d770bc44f9f0923b9f8724396

3 years agodoc/man: lttng(1) command pages: always include `common-footer.txt`
Philippe Proulx [Thu, 6 May 2021 18:45:26 +0000 (14:45 -0400)] 
doc/man: lttng(1) command pages: always include `common-footer.txt`

The end of an lttng(1) command manual page source now looks like this:

    include::common-lttng-cmd-help-options.txt[]

    include::common-lttng-cmd-after-options.txt[]

    include::common-footer.txt[]

`common-lttng-cmd-after-options.txt` contains the "EXIT STATUS",
"ENVIRONMENT", and "FILES" sections.

`common-footer.txt` begins with the "RESOURCES" section.

This will make it possible to insert an "EXAMPLES" section between
`common-lttng-cmd-after-options.txt` and `common-footer.txt`.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1eee42d7386f4671d9825e9d3e131e54f868ee39

3 years agodoc/man: follow man-pages(7) for section names/order and for "SEE ALSO"
Philippe Proulx [Thu, 6 May 2021 18:14:08 +0000 (14:14 -0400)] 
doc/man: follow man-pages(7) for section names/order and for "SEE ALSO"

Changes, following the "Sections within a manual page" section of
man-pages(7):

* Rename the "ENVIRONMENT VARIABLES" section to "ENVIRONMENT".

* Rename the "COPYRIGHTS" section to "COPYRIGHT".

* Move the "EXIT STATUS" section immediately after the "OPTIONS"
  section.

* Remove the "BUGS" section.

  Such a section indicates known bugs (why would you ever have such
  a section anyway?).

  The "RESOURCES" section now contains the URL of our bug tracker.

* Sort the manual pages by section, and then by name in the "SEE ALSO"
  section.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3d91073ec876efd98dcc723ddf40272c814663dd

3 years agoFix: action-executor: leak of `work_item::subitems` field
Francis Deslauriers [Fri, 7 May 2021 21:44:52 +0000 (17:44 -0400)] 
Fix: action-executor: leak of `work_item::subitems` field

This leak can be reproduced by adding a trigger and looking at the used
memory of the lttng-sessiond process.

Valgrind reports the following leak:
  ==2472== 7,087,968 bytes in 147,666 blocks are definitely lost in loss record 24 of 24
  ==2472==    at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==2472==    by 0x191C37: zmalloc (macros.h:45)
  ==2472==    by 0x195234: action_executor_enqueue_trigger (action-executor.c:913)
  ==2472==    by 0x171AD7: dispatch_one_event_notifier_notification (notification-thread-events.c:4626)
  ==2472==    by 0x171D1E: handle_one_event_notifier_notification (notification-thread-events.c:4715)
  ==2472==    by 0x171DA4: handle_notification_thread_event_notification (notification-thread-events.c:4730)
  ==2472==    by 0x164EA6: handle_event_notification_pipe (notification-thread.c:591)
  ==2472==    by 0x1656C3: thread_notification (notification-thread.c:727)
  ==2472==    by 0x17BD16: launch_thread (thread.c:66)
  ==2472==    by 0x5F086DA: start_thread (pthread_create.c:463)
  ==2472==    by 0x624188E: clone (clone.S:95)

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3d98e3ae18c5b2d7f400407842a7de17716f680c

3 years agolttng: change a few instances of trigger "id" to "name"
Simon Marchi [Tue, 27 Apr 2021 22:00:28 +0000 (18:00 -0400)] 
lttng: change a few instances of trigger "id" to "name"

The term trigger "id" has been changed to trigger "name", these are
leftovers. Fix them.

Change-Id: Ic05925af1cd25917de75a0a4d061324604e5a599
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoChange "event rule hit" to "event-rule matches" in user interface strings
Simon Marchi [Tue, 27 Apr 2021 18:51:08 +0000 (14:51 -0400)] 
Change "event rule hit" to "event-rule matches" in user interface strings

The condition name was changed from "event rule hit" to "event rule
matches", but there are some leftover user-visible strings with the old
name. Fix them.

Change-Id: I619c9265d68ca6bf4a3ac11ef38cabc715b01110
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: relayd: live: data is missing between viewer attach and retry
Jonathan Rajotte [Thu, 6 May 2021 15:14:52 +0000 (11:14 -0400)] 
Fix: relayd: live: data is missing between viewer attach and retry

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

Data produced between the time a live viewer attach and a viewer
subsequent "polling" is missing from the point of view of the viewer.

Using the following reproducer:

  # A lttng-sessiond is already running
  lttng-relayd -b -vvv > relayd.log 2>&1
  lttng create live --live
  lttng enable-event -u "hello_world:*"
  lttng start

  date
  # Set the "polling" interval at ~30 seconds
  babeltrace2 --retry-duration=30000000 -i lttng-live net://localhost/host/$HOSTNAME/live &
  pid=$!

  # Make sure we are in the retry phase of bt2
  date
  sleep 2

  # Produce events
  # Note here that hello perform a sleep of 1 seconds before generating
  # 10 events to make sure lttng-ust had time to register. A total of
  # 100 events is generated.
  date
  for i in `seq 1 10`; do
   ./hello
  done

  # Here we expect to see 100 events outputted at some point (~18
  # seconds (30 - 2 - 10) from that time).
  # No events are received by babeltrace2.
  date
  sleep 40
  date

  # We retry the same exercise a second time.
  echo "Moving to phase 2"
  date
  for i in `seq 1 10`; do
   ./hello
  done

  # Here data is received correctly.
  date
  sleep 40
  date

  kill $pid
  wait

  lttng destroy live
  pkill lttng-relayd

Cause
=====

At the moment the viewer attach is done, no streams exist. On the
following viewer_get_new_streams (~30 seconds later), streams now exist
since they were allocated lazily following the first application
registration, but LTTNG_VIEWER_SEEK_LAST is used. This essentially
"discards" any events in the stream that happened between the attach
time and the viewer_get_new_stream execution.

Note that the same problem would happen if a new UID (in per-uid mode)
would happen to begin tracing in between viewer retry.

Solution
========

Always use `LTTNG_VIEWER_SEEK_BEGINNING` during
`viewer_get_new_streams`.

Known drawbacks
=========

This does not fix the per-pid problem where an app run and die in between
the viewer retries.

References
==========

https://lists.lttng.org/pipermail/lttng-dev/2021-May/029953.html

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I92fbe6511fb93e31d20922b4eef5c9a221e07716

3 years agoBuild fix: filter-grammar-test: incorrect inclusion flag
Jérémie Galarneau [Thu, 6 May 2021 22:43:44 +0000 (18:43 -0400)] 
Build fix: filter-grammar-test: incorrect inclusion flag

Including src/common causes LTTng files that clash with system headers
to be included before the system headers and breaks the build on
multiple platforms and architectures.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iff7b6e7000d907dc076a467d223c91569b783861

3 years agoTests: fix: test_tp_fail: bail out on non-existing relay daemon
Jérémie Galarneau [Thu, 6 May 2021 19:48:02 +0000 (15:48 -0400)] 
Tests: fix: test_tp_fail: bail out on non-existing relay daemon

Fatal thread errors simulated by the tp_fail test cause the relay
daemon to shutdown. This is unexepected by stop_lttng_relayd_notap
which bails out, causing the test to fail.

We bail-out when the daemon is already dead to catch crashes
during the test suite since a0f8e310.

Use the clean-up variant so that we don't fail the tests for this
expected outcome.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I02e7f35451b3c81e7e808e9ff96b6c824fa8f904

3 years agobuild system: support rotation example
Jonathan Rajotte [Wed, 28 Apr 2021 00:13:13 +0000 (20:13 -0400)] 
build system: support rotation example

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Icf5f88dcc725967b7fda66db6e047cdf18a89f01

3 years agoAdd trigger on event rule matches application example
Jonathan Rajotte [Fri, 14 Feb 2020 23:26:39 +0000 (18:26 -0500)] 
Add trigger on event rule matches application example

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ice78e15aa1f4380925a272def8bcc7ca331c0aa0

3 years agoUpdate the remaining manual pages for LTTng-tools 2.13
Philippe Proulx [Thu, 29 Apr 2021 21:00:07 +0000 (17:00 -0400)] 
Update the remaining manual pages for LTTng-tools 2.13

This patch updates the remaining manual pages for LTTng-tools 2.13.

This patch:

* Improves the consistency of some command descriptions in
  `configure.ac`.

* Adds `common-daemon-cfg.txt` which is a section explaining how to
  configure a daemon (session or relay).

  lttng-sessiond(8) and lttng-relayd(8) include this file.

* Adds `lttng-concepts.7.txt` which is an adapted copy of the
  "Core concepts" section of the online LTTng Documentation.

  This centralizes all the LTTng theory into a single manual page
  instead of having this information split into multiple lttng(1)
  command manual pages.

  Many manual pages now refer to lttng-concepts(7), making it possible
  to cut a lot of text in those.

* Updates existing manual pages to:

  * Have a style and voice which is more consistent with the LTTng
    Documentation (website) for 2.13.

  * Fix various terminology ambiguities.

  * Use more textual variables and lists to explain more complex logic
    and processes.

  * Always use the same pattern to specify the behaviour of an lttng(1)
    command depending on the `SESSION` argument or the `--session`
    option.

  * For the commands which can perform more than one task, list their
    available tasks at the beginning of the "DESCRIPTION" section.

  * For some lttng(1) commands which can operate on all tracing sessions
    (for example, lttng-clear(1) and lttng-destroy(1)), always indicate
    that they target all your Unix user's tracing sessions or, if your
    Unix user is `root`, the tracing sessions of all the Unix users
    within the root session daemon.

  * Clean the "SEE ALSO" sections.

  * Always have "LTTng" in the "NAME" section of a manual page.

  More specifically:

  lttng-create(1):
      * Clarify the tracing session modes.

      * Clarify how the command adds (or not) a snapshot output for a
        snapshot mode tracing session.

      * Specify that `--output=DIR` is equivalent to
        `--set-url=file://DIR`.

  lttng-enable-channel(1):
      Include the `--discard`, `--buffers-uid`, and `--buffers-global`
      options in the "SYNOPSIS" section even if they are the current
      defaults.

  lttng-list(1):
      Explain what this command does exactly using a tree of options
      and arguments.

  lttng-load(1):
      Clarify how LTTng finds tracing session configurations.

  lttng-relayd(8):
      * Document the missing `--group` option.

      * Rework the text in general.

      * Add a daemon configuration section with an INI file example.

      * Add more cross-references between options and equivalent
        environment variables.

  lttng-rotate(1):
      Specify that the `rotate-session` trigger action can also rotate
      a tracing session.

  lttng-save(1):
      Clarify the output path.

  lttng-sessiond(8):
      Add more cross-references between options and equivalent
      environment variables.

  lttng-shapshot(1):
      * Clarify everything related to the snapshot output of a tracing
        session, including when and how the lttng-create(1) command adds
        an initial snapshot output.

      * Specify that the `snapshot-session` trigger action can also take
        a snapshot of a tracing session.

  lttng-track(1):
  lttng-untrack(1):
      * Simply refer to allowing processes to record events and to
        process attribute inclusion sets instead of using the vague
        "tracker" terminology.

      * Restate that those commands control an implicit condition of
        a recording event rule, as per lttng-concepts(7).

      * Improve the documentation of each inclusion set selection
        option.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iac7498ee979fe077f0927a9b8335f6c07f203989

3 years agodoc/man/manpage.xsl: do not indent the title of an admonition block
Philippe Proulx [Mon, 3 May 2021 19:46:51 +0000 (15:46 -0400)] 
doc/man/manpage.xsl: do not indent the title of an admonition block

See the new comment in `manpage.xsl` for more details.

I copied and modified some upstream DocBook XSL (as found in
`xsl/manpages/block.xsl`).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I765ce37957907edb4088a4212c1b12af8b485e60

3 years agoFix: lttng: add-trigger: invalid access past end of exclusions buffer
Jérémie Galarneau [Thu, 29 Apr 2021 23:01:44 +0000 (19:01 -0400)] 
Fix: lttng: add-trigger: invalid access past end of exclusions buffer

The following command causes the `lttng` client to SEGFAULT on 32-bit
machines:
  lttng add-trigger \
    --condition event-rule-matches --domain=user \
                '--name=jean-*' \
                --exclude-name jean-chretien -x jean-charest \
    --action notify

Running with valgrind results in the following report:

Invalid read of size 8
   at 0x12EEA4: validate_exclusion_list (enable_events.c:354)
   by 0x149018: parse_event_rule (add_trigger.c:964)
   by 0x148356: handle_condition_event (add_trigger.c:1222)
   by 0x147EC3: parse_condition (add_trigger.c:1300)
   by 0x147702: cmd_add_trigger (add_trigger.c:2107)
   by 0x154067: handle_command (lttng.c:237)
   by 0x1534D1: parse_args (lttng.c:426)
   by 0x152C54: main (lttng.c:475)

validate_exclusion_list expects a NULL terminated array of exclusions
while handle_condition_event prepares an array of exclusions using
the dynamic pointer array facilities (which doesn't need to
null-terminate arrays).

The code that deals with exclusions "lists" mixes various conventions
(null-terminated vs explicit size) in different places leading to this
kind of errors.

All the code that references exclusion lists, along with the string
utils, are adapted to make use of the common dynamic pointer array
facilities.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Icbb7f0e8601c7ecc887dc9ae64d0ec6390e6aba3

3 years agoFix: tests: extra arguments are not passed to the remove trigger command
Jonathan Rajotte [Wed, 5 May 2021 17:34:00 +0000 (13:34 -0400)] 
Fix: tests: extra arguments are not passed to the remove trigger command

Observed issue
==============
CI root jobs fails on the remove trigger operation for the user_trigger
trigger during the test_ust_notifier_discarded_count_multi_uid test.

Cause
=====
The `--owner uid` option and its argument are not passed during the
command execution.

Solution
========
Pass all extra parameters for the command execution.

Known drawbacks
=========

None.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ic7b5d46b6793cda16a474c5459f9bf533812fe61

3 years agoFix: lttng-ctl: erroneous check if user is part of the tracing group
Jérémie Galarneau [Mon, 3 May 2021 16:50:25 +0000 (12:50 -0400)] 
Fix: lttng-ctl: erroneous check if user is part of the tracing group

in_tgroup is set to `-1` whenever the current user is not part of the
tracing group _or_ if an error occurred while looking up if the user
is part of the tracing group. In other words, the value '0' is unused.

in_tgroup must be explicitly checked against '1' and can't be assumed
to behave as a boolean value.

This is _not_ a security issue: if the user is not part of the tracing
group, she will fail to open the root session damon's socket because
of the kernel-side permission checking. However, the behaviour of the
lttng client (and error reporting) will be confusing.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I614da0123d0546c5f54f121e8ed9716d6e292400

3 years agoBuild fix: kernel-consumerd: merge conflict left in file
Jérémie Galarneau [Mon, 3 May 2021 15:52:51 +0000 (11:52 -0400)] 
Build fix: kernel-consumerd: merge conflict left in file

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I71defaee6724a08661567af879b91a57d9dae74c

3 years agoClean-up: consumerd: use a specific status code for get_next_subbuffer
Jérémie Galarneau [Fri, 30 Apr 2021 16:12:44 +0000 (12:12 -0400)] 
Clean-up: consumerd: use a specific status code for get_next_subbuffer

The implementation of "get next subbuffer" of the user space and kernel
tracers return different error codes (-ENODATA and -EAGAIN) which are
are confusing to handle in the generic code.

Since the difference between -ENODATA and -EAGAIN makes no material
difference in the current consumerd implementation, those conditions
are abstracted by a common GET_NEXT_SUBBEFFER_STATUS_NO_DATA.

Otherwise, the callers handle 'OK' and the generic 'ERROR' condition
which makes the transport of more specific "errno" values useless for
the moment.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ibdb2837396e4b8cd291ffd80f6ca59b39ce3f707

3 years agoFix: kernel consumer: get next subbuffer EAGAIN handling
Mathieu Desnoyers [Fri, 30 Apr 2021 16:02:47 +0000 (12:02 -0400)] 
Fix: kernel consumer: get next subbuffer EAGAIN handling

The caller of get next subbuffer (data and metadata) callbacks only
expects -ENODATA when there is no data to read. However, the kernel
tracer distinguishes between no data for a finalized stream (-ENODATA)
and no data for a non-finalized stream (-EAGAIN).

Given that the consumer daemon uses the POLLHUP returned by epoll to
detect stream end of life, it does not care about the distinction
between -EAGAIN and -ENODATA when streaming.

However, taking a snapshot of a metadata stream uses the distinction
between nodata and again. Change this so it considers a return value of
0 from lttng_consumer_read_subbuffer to mean there is no more data to
read, so we can combine -EAGAIN and -ENODATA within get next subbuffer
callbacks and return -ENODATA for both.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I30786985c2389570dd342e55d4faf7c552532f8b

3 years agoFix: kernel consumer: signal metadata ready condition variable
Mathieu Desnoyers [Fri, 30 Apr 2021 14:44:44 +0000 (10:44 -0400)] 
Fix: kernel consumer: signal metadata ready condition variable

The behaviour of the kernel consumer does not match that of the user
space consumer. When a live metadata stream goes back to "sleep", it
must broadcast on the metadata_rdv to wake-up any thread that is
performing a metadata sync.

This mismatch causes a hang in the kernel consumer during the kernel
clear tests.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ief15fc2b7c92582ea36bf64d185720e48d2c94d5

3 years agoFix: consumerd: unbalanced subbuffer 'get' when checking operation availability
Jérémie Galarneau [Thu, 29 Apr 2021 20:17:45 +0000 (16:17 -0400)] 
Fix: consumerd: unbalanced subbuffer 'get' when checking operation availability

A WARN_ON in lttng-modules is hit in the get_subbuf ioctl, which
pointed to an unbalanced get/put pair when accessing the subbuffers
of a channel.

517716.168856] ------------[ cut here ]------------
[517716.171559] WARNING: CPU: 1 PID: 19313 at /home/efficios/git/lttng-modules/src/lib/ringbuffer/ring_buffer_frontend.c:1263 lib_ring_buffer_get_subbuf+0x24f/0x260 [lttng_lib_ring_buffer]
[517716.180096] Modules linked in: lttng_test(O) lttng_probe_x86_exceptions(O) lttng_probe_x86_irq_vectors(O) lttng_probe_writeback(O) lttng_probe_workqueue(O) lttng_probe_vmscan(O) lttng_probe_udp(O) lttng_probe_timer(O) lttng_probe_sunrpc(O) lttng_probe_statedump(O) lttng_probe_sock(O) lttng_probe_skb(O) lttng_probe_signal(O) lttng_probe_scsi(O) lttng_probe_sched(O) lttng_probe_regulator(O) lttng_probe_regmap(O) lttng_probe_rcu(O) lttng_probe_random(O) lttng_probe_printk(O) lttng_probe_power(O) lttng_probe_net(O) lttng_probe_napi(O) lttng_probe_module(O) lttng_probe_kmem(O) lttng_probe_jbd2(O) lttng_probe_irq(O) lttng_probe_i2c(O) lttng_probe_gpio(O) lttng_probe_ext4(O) lttng_probe_compaction(O) lttng_probe_btrfs(O) lttng_probe_block(O) lttng_counter_client_percpu_32_modular(O) lttng_counter_client_percpu_64_modular(O) lttng_counter(O) lttng_ring_buffer_event_notifier_client(O) lttng_ring_buffer_metadata_mmap_client(O) lttng_ring_buffer_client_mmap_overwrite(O)
[517716.180815]  lttng_ring_buffer_client_mmap_discard(O) lttng_ring_buffer_metadata_client(O) lttng_ring_buffer_client_overwrite(O) lttng_ring_buffer_client_discard(O) lttng_tracer(O) lttng_statedump(O) lttng_wrapper(O) lttng_uprobes(O) lttng_clock(O) lttng_kprobes(O) lttng_lib_ring_buffer(O) lttng_kretprobes(O) [last unloaded: lttng_wrapper]
[517716.213228] CPU: 1 PID: 19313 Comm: lttng-consumerd Tainted: G           O      5.11.2 #80
[517716.215573] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
[517716.220341] RIP: 0010:lib_ring_buffer_get_subbuf+0x24f/0x260 [lttng_lib_ring_buffer]
[517716.222579] Code: 50 f0 ff 00 0f 0b 49 03 5f 28 44 8b 85 80 00 00 00 49 8b 77 30 45 85 c0 48 89 d9 0f 85 4f ff ff ff e9 25 ff ff ff f0 ff 45 00 <0f> 0b b8 f0 ff ff ff e9 a6 fe ff ff 0f 1f 44 00 00 0f 1f 44 00 00
[517716.227610] RSP: 0018:ffffbafd09023e88 EFLAGS: 00010202
[517716.229147] RAX: 0000000000000000 RBX: ffff9906ed069a00 RCX: ffff9905c4e4a400
[517716.231186] RDX: ffffdafcffc4ec90 RSI: 0000000000200000 RDI: ffffdafcffc4e9f0
[517716.233265] RBP: ffff9905c4e4a400 R08: 0000000000300000 R09: 0000000000200000
[517716.235284] R10: 0000000000200000 R11: 0000000000000000 R12: 0000000000000000
[517716.237333] R13: 0000000000000000 R14: 000000000000005e R15: 0000000000000000
[517716.239360] FS:  00007ff327fff700(0000) GS:ffff9905a7a40000(0000) knlGS:0000000000000000
[517716.241634] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[517716.243262] CR2: 000055b91cf07730 CR3: 000000076f45e003 CR4: 00000000001706e0
[517716.245316] Call Trace:
[517716.246281]  lib_ring_buffer_ioctl+0x181/0x300 [lttng_lib_ring_buffer]
[517716.248301]  lttng_stream_ring_buffer_ioctl+0x1a3/0x200 [lttng_tracer]
[517716.252621]  __x64_sys_ioctl+0x8e/0xd0
[517716.253931]  do_syscall_64+0x33/0x80
[517716.255016]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[517716.256448] RIP: 0033:0x7ff3372f46d7
[517716.257586] Code: b3 66 90 48 8b 05 b1 47 2d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 81 47 2d 00 f7 d8 64 89 01 48
[517716.262472] RSP: 002b:00007ff327ffe2c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[517716.264634] RAX: ffffffffffffffda RBX: 00007ff310002740 RCX: 00007ff3372f46d7
[517716.266674] RDX: 0000000000000000 RSI: 000000000000f605 RDI: 000000000000005e
[517716.268713] RBP: 00007ff327ffe310 R08: 00007ff310002870 R09: a002000000000000
[517716.270732] R10: 000055992b0a6530 R11: 0000000000000246 R12: 000055992c47da70
[517716.272768] R13: 00007ff318005e80 R14: 00007ff310002740 R15: 000055992b0a6528
[517716.274800] irq event stamp: 4526705
[517716.275897] hardirqs last  enabled at (4526713): [<ffffffff9016a474>] console_unlock+0x4b4/0x5b0
[517716.278320] hardirqs last disabled at (4526722): [<ffffffff9016a3d0>] console_unlock+0x410/0x5b0
[517716.280759] softirqs last  enabled at (4526658): [<ffffffff9120030f>] __do_softirq+0x30f/0x432
[517716.285125] softirqs last disabled at (4526653): [<ffffffff91001052>] asm_call_irq_on_stack+0x12/0x20
[517716.287648] ---[ end trace 506e55b312b731bf ]---

The check for the availability of the 'get_next_check_metadata'
operation attempts to use the operation at the creation of the metadata
stream. Most of the time this occurs before any metadata could be
generated.

However, the check will sometimes (very rarely) occur after the
generation of some metadata causing the 'get' to succeed and,
consequently, a subbuffer to be acquired. In those cases, the subbuffer
must be released immediately.

Fixes #1313

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I906dca7d83ce103c009aa477ae5881145e4aa081

3 years agosessiond: remove commented-out logging
Jérémie Galarneau [Wed, 28 Apr 2021 21:50:41 +0000 (17:50 -0400)] 
sessiond: remove commented-out logging

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I7b8991ba994585fd8f2b5c6e02b9be7cf8e7123b

3 years agosessiond: Remove [.*-thread] logging prefix
Jérémie Galarneau [Wed, 28 Apr 2021 21:44:52 +0000 (17:44 -0400)] 
sessiond: Remove [.*-thread] logging prefix

The logger now logs the thread name making this prefix useless.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie9093e4032d2cf0d3c0e9fa0d7eda28467033931

3 years agorun-as: reduce verbosity of fd sending error paths
Francis Deslauriers [Mon, 26 Apr 2021 22:18:11 +0000 (18:18 -0400)] 
run-as: reduce verbosity of fd sending error paths

Issue
=====

A testcase in `tests/regression/tools/save-load/test_save` tests that
saving a session on an already existing configuration file fails.

The test case fails as expected but it is a bit noisy in terms of error
reporting:
  ok 9 - Enable channel chan-save for session save-42
  ok 10 - Enable ust event tp:tptest for session save-42
  Error: Attempt to send invalid file descriptor to master (fd = -1)
  PERROR - 09:57:10.893683118 [Client management]: Could not create configuration file: File exists (in save_session() at save.c:2706)
  PERROR - 09:57:10.893714862 [Main]: Failed to close result file descriptor: Bad file descriptor (in send_fds_to_master() at runas.c:824)
  ok 11 - Session failed to be saved. Expected!

We see that 3 error statements are printed by the sessiond but only the
second is really relevant.

Fix
===

This commit:
- changes the first `ERR()` statement to a `DBG()` statement, and
- only call `close()` on seemingly valid FDs.

Notes
=====

This commit also removes the mention of "master" in the first `DBG()`
statement as this function is used by both the master and the runas
process.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie77d44233a770610f8a3f4412b84c0fd70c0812e

3 years agoSet thread name of run-as worker process
Francis Deslauriers [Mon, 26 Apr 2021 22:09:54 +0000 (18:09 -0400)] 
Set thread name of run-as worker process

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ifd89ad19a17d96975f712bcd298588f2fc28d04f

3 years agoUse new ioctl macros with fixed ioctl direction
Francis Deslauriers [Tue, 27 Apr 2021 18:26:09 +0000 (14:26 -0400)] 
Use new ioctl macros with fixed ioctl direction

Update the ioctl commands to follow the changes in this commit:
  commit 8c71721f7a868b575b05e24bc3a3dcc967e6d5d6
  Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  Date:   Tue Apr 20 11:05:19 2021 -0400

      Fix: LTTng-modules ABI ioctl wrong direction

This commit uses the new command first, and if -ENOSYS is returned by
the LTTng kernel tracer it falls back to the old command.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2604ea5902fec3bf574c7a249cb65784685a0ae8

This page took 0.050683 seconds and 5 git commands to generate.