lttng-tools.git
6 years agodoc: how to trace consumerd with valgrind
Mathieu Desnoyers [Mon, 8 May 2017 12:38:37 +0000 (08:38 -0400)] 
doc: how to trace consumerd with valgrind

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCleanup: initialize kernel ioctl ABI structures to 0
Mathieu Desnoyers [Mon, 8 May 2017 12:34:57 +0000 (08:34 -0400)] 
Cleanup: initialize kernel ioctl ABI structures to 0

Valgrind complains that we pass uninitialized data to the kernel.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCleanup: initialize data to 0
Mathieu Desnoyers [Mon, 8 May 2017 12:15:20 +0000 (08:15 -0400)] 
Cleanup: initialize data to 0

Valgrind catches read of uninitialized data caused by the on-stack
"data" argument which ends up not being fully initialized (it contains a
union).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: consumer data lock deadlock caused by monitor timer
Jérémie Galarneau [Mon, 8 May 2017 19:06:25 +0000 (15:06 -0400)] 
Fix: consumer data lock deadlock caused by monitor timer

The execution of the monitor timer takes the consumer data lock
which causes three threads to deadlock.

The consumer_thread_data_poll_thread takes the lock during
the teardown of a channel. This teardown stops the channel's
timers and, to ensure that the timers are not fired on a free'd
channel, uses a custom SIG_TEARDOWN signal as a "bubble" inserted
the signal processing "queue". It then waits until this signal
has been processed to release the consumer data lock.

The sessiond_poll_thread is creating a channel and waits on
the consumer data lock.

Meanwhile, the timer thread is blocked on this same lock
during the processing of the monitor timer signal which
prevents the queue from being flushed, causing the destruction
of the channel to never reach completion.

There is no need to take the consumer data lock in the monitor
timer code since the channel's existence is guaranteed by
the SIG_TEARDOWN mechanism.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: assert() on null index_file in lttng_index_file_write()
Jonathan Rajotte [Mon, 24 Apr 2017 19:59:20 +0000 (15:59 -0400)] 
Fix: assert() on null index_file in lttng_index_file_write()

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: fail on relayd lookup when finding a relayd is expected
Jonathan Rajotte [Mon, 24 Apr 2017 19:32:15 +0000 (15:32 -0400)] 
Fix: fail on relayd lookup when finding a relayd is expected

An actual relayd lookup error leads to using the code path of a local
handling. Since stream->index_file is NULL when expecting a relayd, using
the code path for local handling results in an invalid access.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoClean-up: use lttng_read() wrapper instead of read()
Jérémie Galarneau [Mon, 8 May 2017 15:09:41 +0000 (11:09 -0400)] 
Clean-up: use lttng_read() wrapper instead of read()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: NULL pointer dereference in lttng_condition_serialize
Jérémie Galarneau [Sun, 7 May 2017 19:51:42 +0000 (15:51 -0400)] 
Fix: NULL pointer dereference in lttng_condition_serialize

Reported-by: Coverity Scan
*** CID 1374823:  Null pointer dereferences  (REVERSE_INULL)

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: Exclusion check iterates multiple times on same array
Francis Deslauriers [Fri, 5 May 2017 17:45:36 +0000 (13:45 -0400)] 
Fix: Exclusion check iterates multiple times on same array

When specifying exclusions not contained in the event string warning
message is printed more than once.

For example, running the following command:

  lttng enable-event -u 'event_name_*' --exclude=not_event,other_event,my_event

Will result in this warning:
  Warning: Event event_name_*: not_event does not exclude any events from event_name_*
  Warning: Event event_name_*: other_event does not exclude any events from event_name_*
  Warning: Event event_name_*: my_event does not exclude any events from event_name_*
  Warning: Event event_name_*: other_event does not exclude any events from event_name_*
  Warning: Event event_name_*: my_event does not exclude any events from event_name_*
  Warning: Event event_name_*: my_event does not exclude any events from event_name_*

The following should be printed:
  Warning: Event event_name_*: not_event does not exclude any events from event_name_*
  Warning: Event event_name_*: other_event does not exclude any events from event_name_*
  Warning: Event event_name_*: my_event does not exclude any events from event_name_*

This is due to a bad indexing of the exclusions array.

Since we are already iterating on the exclusions array, pass the
exclusions directly with check_exclusion_subset().

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: return of free'd string on error in strutils_split()
Jérémie Galarneau [Sat, 6 May 2017 19:20:29 +0000 (15:20 -0400)] 
Fix: return of free'd string on error in strutils_split()

Reported-by: Coverity Scan
CID 1374808 (#1 of 1): Use after free (USE_AFTER_FREE)
use_after_free: Using freed pointer substrings.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: free of uninitialized value on error path
Jérémie Galarneau [Sat, 6 May 2017 19:08:31 +0000 (15:08 -0400)] 
Fix: free of uninitialized value on error path

Reported-by: Coverity Scan
CID 1374805 (#1 of 1): Uninitialized pointer read (UNINIT)
uninit_use_in_call: Using uninitialized value extended when
calling free.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoSilence bogus Coverity warning of uninitialized value
Jérémie Galarneau [Sat, 6 May 2017 19:04:27 +0000 (15:04 -0400)] 
Silence bogus Coverity warning of uninitialized value

Coverity complains that struct lttng_trigger_comm's
payload field is not initialized. "payload" is a flexible
array member which should be ignored. Normally, a such a
member _could_ result in additional padding added at the
end of the structure. In this case, the structure is declared
as packed.

Nonetheless, using a designated initializer gets rid of the
ambiguity and silences Coverity.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoSilence bogus Coverity warning of uninitialized value
Jérémie Galarneau [Sat, 6 May 2017 18:59:48 +0000 (14:59 -0400)] 
Silence bogus Coverity warning of uninitialized value

Coverity complains that struct lttng_notification_comm's
payload field is not initialized. "payload" is a flexible
array member which should be ignored. Normally, a such a
member _could_ result in additional padding added at the
end of the structure. In this case, the structure is declared
as packed.

Nonetheless, using a designated initializer gets rid of the
ambiguity and silences Coverity.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoSilence bogus Coverity warning of uninitialized value
Jérémie Galarneau [Sat, 6 May 2017 18:54:33 +0000 (14:54 -0400)] 
Silence bogus Coverity warning of uninitialized value

Coverity complains that struct lttng_condition_comm's payload
field is not initialized. "payload" is a flexible array
member which should be ignored. Normally, a such a member
_could_ result in additional padding added at the end of the
structure. In this case, the structure is declared as packed.

Nonetheless, using a designated initializer gets rid of the
ambiguity and silences Coverity.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoSilence bogus Coverity warning of uninitialized value
Jérémie Galarneau [Sat, 6 May 2017 18:43:46 +0000 (14:43 -0400)] 
Silence bogus Coverity warning of uninitialized value

Coverity complains that struct lttng_evaluation_comm's payload
field is not initialized. "payload" is a flexible array
member which should be ignored. Normally, a such a member
_could_ result in additional padding added at the end of the
structure. In this case, the structure is declared as packed.

Nonetheless, using a designated initializer gets rid of the
ambiguity and silences Coverity.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: dereference before null check of channel attributes
Jérémie Galarneau [Sat, 6 May 2017 18:34:42 +0000 (14:34 -0400)] 
Fix: dereference before null check of channel attributes

Reported-by: Coverity Scan
CID 1374802 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking attr suggests that it may be null,
but it has already been dereferenced on all paths leading to the check.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: memory leak of client_list_element
Jérémie Galarneau [Sat, 6 May 2017 18:31:22 +0000 (14:31 -0400)] 
Fix: memory leak of client_list_element

Reported-by: Coverity Scan
CID 1374799:  Resource leaks  (RESOURCE_LEAK)
Variable "client_list_element" going out of scope leaks the storage
it points to.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: unchecked lttng_dynamic_buffer_set_size return value
Jérémie Galarneau [Sat, 6 May 2017 18:29:19 +0000 (14:29 -0400)] 
Fix: unchecked lttng_dynamic_buffer_set_size return value

Reported-by: Coverity Scan
*** CID 1374796:  Error handling issues  (CHECKED_RETURN)

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd 2.10 release beer name and description
Jérémie Galarneau [Sat, 6 May 2017 01:36:59 +0000 (21:36 -0400)] 
Add 2.10 release beer name and description

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoBuild: missing includes for ssize_t definition on Cygwin
Jérémie Galarneau [Sat, 6 May 2017 01:10:19 +0000 (21:10 -0400)] 
Build: missing includes for ssize_t definition on Cygwin

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: consumer-timer.c includes ust-ctl.h even --without-lttng-ust
Jérémie Galarneau [Fri, 5 May 2017 22:39:43 +0000 (18:39 -0400)] 
Fix: consumer-timer.c includes ust-ctl.h even --without-lttng-ust

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: missing header in Makefile breaks the dist build
Jérémie Galarneau [Fri, 5 May 2017 22:30:52 +0000 (18:30 -0400)] 
Fix: missing header in Makefile breaks the dist build

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTests fix: tracefile-size tests assume PAGE_SIZE subbuffers
Jérémie Galarneau [Fri, 5 May 2017 22:23:25 +0000 (18:23 -0400)] 
Tests fix: tracefile-size tests assume PAGE_SIZE subbuffers

The new subbuffer default sizes break this test as it assumes
that the default size of subbuffers is of 1 page.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: use of uninitialized channel attributes in client
Jérémie Galarneau [Fri, 5 May 2017 20:07:43 +0000 (16:07 -0400)] 
Fix: use of uninitialized channel attributes in client

The channel attributes used to retrieve the defaults to use
are not zero-initialized which is a problem now that the extended
pointer is used to determine whether or not the structure was
allocated on stack by the user (for backward compatibility) or
dynamically using the new lttng_channel_create() interface.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoClean-up: only declare help_msg in embedded help case
Jérémie Galarneau [Fri, 5 May 2017 19:49:46 +0000 (15:49 -0400)] 
Clean-up: only declare help_msg in embedded help case

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: use of session_name instead of channel_name in condition hash
Jérémie Galarneau [Fri, 5 May 2017 19:36:15 +0000 (15:36 -0400)] 
Fix: use of session_name instead of channel_name in condition hash

Reported-by: Coverity Scan
** CID 1374796:  Error handling issues  (CHECKED_RETURN)
/src/lib/lttng-ctl/channel.c: 84 in receive_message()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: lttng-live: send HUP reply when per-PID streams are gone
Mathieu Desnoyers [Tue, 2 May 2017 14:37:28 +0000 (10:37 -0400)] 
Fix: lttng-live: send HUP reply when per-PID streams are gone

Currently, the "HUP" reply (hung up) is only sent when a session destroy
is performed and all data has been sent. However, with per-pid buffers,
application can come and go during the tracing session, so we need to
send the HUP reply for each individual stream that is gone.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest: use output_path instead of argument position
Jonathan Rajotte [Wed, 5 Apr 2017 14:53:41 +0000 (10:53 -0400)] 
Test: use output_path instead of argument position

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoBump default kernel, and UST per-uid/per-pid buffer size
Mathieu Desnoyers [Fri, 31 Mar 2017 14:04:20 +0000 (10:04 -0400)] 
Bump default kernel, and UST per-uid/per-pid buffer size

LTTng with current default buffer size often lead to discarded events,
which is not something we want as a first user impression.

The choice of default buffer size were made conservatively around 2010.
Since then, the memory available on typical systems has increased, and
so has the amount of instrumentation available. As an example, the
mid-2010 Macbook Pro had 2GB ram. The current 2017 Macbook specification
states 8GB ram, for a 4-fold installed memory size increase.

Increase the kernel tracer buffer size from:
4 x 256kB per core
to:
4 x 1MB per core

Increase the UST tracer per-uid buffer size from:
4 x 128kB per core
to
4 x 512kB per core

Increase the UST tracer per-pid buffer size from:
4 x 4kB per core
to
4 x 16kB per core

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: syscall_table_nb_entry invalid value when no syscalls TPs are defined
Jonathan Rajotte [Wed, 15 Mar 2017 14:59:31 +0000 (10:59 -0400)] 
Fix: syscall_table_nb_entry invalid value when no syscalls TPs are defined

v3: change commit message to include information regarding off-by-one
problems induced by 'index' and the use of 'index' as value of
syscall_table_nb_entry.

--

fscanf on an empty file returns directly without assigning value to
'index' leading to assigning the value of an uninitialized variable to
syscall_table_nb_entry. This can result in memory allocation problems
when listing syscalls on 'lttng list --kernel --syscall'[1][2].

Fixes at the same time an off-by-one problem for the
syscall_table_nb_entry value and an off-by-one error on table memory
reallocation.

The index value returned by fscanf is an index starting at 0. It is
later assigned to syscall_table_nb_entry which is used for memory
allocation and iteration during syscall_table_list. Forgetting to add 1
results in losing the last syscall during listing.

The parsed index value is also used to count how many elements should be
allocated during table reallocation, without any extra increment which
result in an off-by-one error. Hence, make sure to increment its value by
one when assigning the value of syscall_table_nb_entry. It does not
cause issues in practice because SYSCALL_TABLE_INIT_SIZE is nonzero, and
because we don't require the table to expand by more than the double of
its size at once (which could happen if we could have a hole in the
syscall table for instance).

Fixes #1091

[1] https://bugs.lttng.org/issues/1091
[2] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1671063/

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd string-utils to dist subdirs in libcommon
Jérémie Galarneau [Fri, 5 May 2017 18:02:47 +0000 (14:02 -0400)] 
Add string-utils to dist subdirs in libcommon

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTests fix: initialize kernel extended channel attributes
Jérémie Galarneau [Fri, 5 May 2017 17:36:30 +0000 (13:36 -0400)] 
Tests fix: initialize kernel extended channel attributes

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTests fix: initialize UST extended channel attributes
Jérémie Galarneau [Fri, 5 May 2017 16:17:17 +0000 (12:17 -0400)] 
Tests fix: initialize UST extended channel attributes

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agolttng-enable-event(1): document globbing patterns in event names and filters
Philippe Proulx [Fri, 17 Feb 2017 03:56:15 +0000 (22:56 -0500)] 
lttng-enable-event(1): document globbing patterns in event names and filters

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
6 years agoTests: add globbing pattern tests to test_java_log4j
Philippe Proulx [Sat, 18 Feb 2017 21:03:19 +0000 (16:03 -0500)] 
Tests: add globbing pattern tests to test_java_log4j

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
6 years agoTests: add globbing pattern tests to test_java_jul
Philippe Proulx [Sat, 18 Feb 2017 21:03:05 +0000 (16:03 -0500)] 
Tests: add globbing pattern tests to test_java_jul

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
6 years agoTests: add globbing pattern tests to test_python_logging
Philippe Proulx [Sat, 18 Feb 2017 20:10:27 +0000 (15:10 -0500)] 
Tests: add globbing pattern tests to test_python_logging

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
6 years agoTests: add globbing pattern tests to test_valid_filter
Philippe Proulx [Fri, 17 Feb 2017 08:57:16 +0000 (03:57 -0500)] 
Tests: add globbing pattern tests to test_valid_filter

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
6 years agoTests: add globbing pattern tests to test_invalid_filter
Philippe Proulx [Fri, 17 Feb 2017 03:43:10 +0000 (22:43 -0500)] 
Tests: add globbing pattern tests to test_invalid_filter

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
6 years agoTests: add globbing pattern tests to test_event_wildcard
Philippe Proulx [Fri, 17 Feb 2017 03:43:37 +0000 (22:43 -0500)] 
Tests: add globbing pattern tests to test_event_wildcard

This patch also increases the test's channel sub-buffer size and count
because testing with `*` generates a lot of events and there are always
discarded ones.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
6 years agoTests: add globbing pattern tests to test_exclusion
Philippe Proulx [Fri, 17 Feb 2017 03:42:34 +0000 (22:42 -0500)] 
Tests: add globbing pattern tests to test_exclusion

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTests: utils: add gen-ust-nevents-str util
Philippe Proulx [Fri, 17 Feb 2017 08:53:43 +0000 (03:53 -0500)] 
Tests: utils: add gen-ust-nevents-str util

This program generates a given number of UST events, each one having
in its payload the next command-line argument string in a cycle:

    gen-ust-nevents-str 10 hello world its me

will generate 10 events with the following strings:

    hello
    world
    its
    me
    hello
    world
    its
    me
    hello
    world

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTests: add string-utils library unit tests
Philippe Proulx [Fri, 17 Feb 2017 03:01:25 +0000 (22:01 -0500)] 
Tests: add string-utils library unit tests

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd support for "full" star globbing patterns in event names and filters
Philippe Proulx [Wed, 15 Feb 2017 16:38:36 +0000 (11:38 -0500)] 
Add support for "full" star globbing patterns in event names and filters

This patch adds the support for "full" star-only globbing patterns to be
used in event names and filter literal strings. A star-only globbing
pattern is a globbing pattern with the star (`*`) being the only special
character. This means `?` and character sets (`[abc-k]`) are not
supported here. We cannot support them without a strategy to
differentiate the globbing pattern because `?` and `[` are not special
characters in event names passed on the command line and filter literal
strings right now. The eventual strategy to support them would probably
look like this for event names:

    lttng enable-event --userspace --glob 'hell?-wo*rl[Ddz]42'

and like this for filter strings:

    filename =* "?sys*.[ch]"

The reason this patch adds the feature for both the event names and the
filter strings at the same time is that, for some agent domains, a
filter string is used to filter the logger name. For example:

    lttng enable-event --python 'hello*world'

In this case, the UST event name is always `lttng_python`, but a filter
string is added to the event rule:

    logger_name == "hello*world"

If I don't add support for filter strings in this patch, then the
globbing feature for event names would not work for all the domains.

src/bin/lttng/commands/enable_events.c
--------------------------------------
The exclusion validation code is cleaner. strutils_split() is used to
split the list (which also supports `\,` to escape delimiters). Then, if
the event name is a globbing pattern which only contains a wildcard star
at the end (the only valid globbing pattern before this patch), the
exclusions which also only contain a wildcard star at the end or no star
at all are validated like it was done previously, with the exception
that escape characters are considered now (that is, in the exclusion
`hello\*world`, `\*` is parsed as is: the star is not a wildcard).

src/bin/lttng-sessiond/cmd.c
----------------------------
The event name validation function is removed because the only thing it
checks is that a star can only appear at the end of the name. This is
not true anymore.

It is expected that the tracers's globbing matching algorithm expect
a globbing pattern without two or more consecutive stars:

    hello**world

Thus in _cmd_enable_event(), strutils_normalize_star_glob_pattern() is
used to "normalize" the star globbing patterns of event names and
exclusion names in place (if they exist). Normalizing here means
crushing consecutive stars as a single one, without considering escaped
stars:

    hello*\***world**** -> hello*\**world*

Note that this also means that the event and exclusion names given by
the user are not necessarily the ones remaining after the enable-event
command is executed. This should not be a problem as `lttng status`
shows the normalized names and normalization is an identity function
when the string is already normalized.

src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c
-----------------------------------------------------
The literal string transformation is modified to include the type of
literal string in the node amongst:

* IR_LOAD_STRING_TYPE_PLAIN
* IR_LOAD_STRING_TYPE_GLOB_STAR_END
* IR_LOAD_STRING_TYPE_GLOB_STAR

This type is used for post-validation and bytecode translation.

src/lib/lttng-ctl/filter/filter-bytecode.h
src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c
-----------------------------------------------------------
A new load bytecode operation is added: FILTER_OP_LOAD_STAR_GLOB_STRING.
When this operation is executed, it should load a string literal as a
full star globbing pattern. The star-at-the-end-only use case is still
expected to be handled by the FILTER_OP_LOAD_STRING operation to avoid
changing anything to the current behaviour.

src/bin/lttng-sessiond/lttng-ust-abi.h
--------------------------------------
Version 7.1 bumped to version 7.2 because a new "load" filter operation
is added to the list of bytecode operations, but the current operation
codes are not changed, so a 7.2 filter interpreter should interpret a
7.1 filter bytecode just fine.

src/common/kernel-ctl/kernel-ioctl.h
------------------------------------
Version 2.2 bumped to version 2.3 because a new "load" filter operation
is added to the list of bytecode operations, but the current operation
codes are not changed, so a 2.3 filter interpreter should interpret a
2.2 filter bytecode just fine.

src/lib/lttng-ctl/filter/filter-visitor-ir-normalize-glob-patterns.c
--------------------------------------------------------------------
This IR visitor normalizes the literal string nodes when their type is
IR_LOAD_STRING_TYPE_GLOB_STAR_END or IR_LOAD_STRING_TYPE_GLOB_STAR.

src/lib/lttng-ctl/filter/filter-visitor-ir-validate-globbing.c
--------------------------------------------------------------
This IR visitor validates that:

1. When there's a binary operation between two literal strings, if one
   of them has the IR_LOAD_STRING_TYPE_GLOB_STAR type, the other one has
   the IR_LOAD_STRING_TYPE_PLAIN type.

   In other words, you cannot compare two globbing patterns, except for
   two globbing patterns with only a star at the end for backward
   compatibility reasons.

2. When there's a binary operation between two literal strings, if one
   of them is a (full) star globbing pattern, the binary operation is
   either == or !=.

src/lib/lttng-ctl/filter/filter-visitor-ir-validate-string.c
------------------------------------------------------------
The code to ensure that a wildcard star can only appear at the end of a
literal string is removed.

src/lib/lttng-ctl/lttng-ctl.c
-----------------------------
New visitors are called.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd string-utils convenience library
Philippe Proulx [Fri, 17 Feb 2017 02:58:19 +0000 (21:58 -0500)] 
Add string-utils convenience library

The new src/common/string-utils/libstring-utils.la library has a few
utility functions to manipulate and check strings. See string-utils.h
for more details.

One such function which should prove useful in this codebase is
strutils_split(): it splits an input string with a given delimiter and
returns a NULL-terminated array of newly allocated substrings. This
function supports escaping the delimiter with `\` in the input string.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agodoc: lttng-destroy(1): document --no-wait option
Philippe Proulx [Tue, 4 Apr 2017 21:27:58 +0000 (17:27 -0400)] 
doc: lttng-destroy(1): document --no-wait option

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agodoc: lttng-stop(1): replace tabs with spaces
Philippe Proulx [Tue, 4 Apr 2017 21:28:20 +0000 (17:28 -0400)] 
doc: lttng-stop(1): replace tabs with spaces

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agodoc/man: add typical `$` and `#` prompts to command lines
Philippe Proulx [Wed, 15 Mar 2017 00:28:35 +0000 (20:28 -0400)] 
doc/man: add typical `$` and `#` prompts to command lines

It is more instinctive for the typical reader to immediately recognize
command lines when they start with the classic prompts.

On the online version of the man pages, those prompts are treated
specially to make them non-selectable. This makes it possible to copy
multiple command lines at once (without copying the prompts) and to
paste them to your shell.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agobin/lttng: remove double "help" command and sort list
Philippe Proulx [Wed, 30 Nov 2016 20:24:36 +0000 (15:24 -0500)] 
bin/lttng: remove double "help" command and sort list

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agolttng help: use command's --help directly
Philippe Proulx [Wed, 30 Nov 2016 20:40:43 +0000 (15:40 -0500)] 
lttng help: use command's --help directly

Do the same thing for both `lttng cmd --help` and
`lttng help cmd`, so that if we change what's done, the
behaviour remains the same for both methods.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd --enable-embedded-help option to embed --help messages in binaries
Philippe Proulx [Thu, 1 Dec 2016 06:29:38 +0000 (01:29 -0500)] 
Add --enable-embedded-help option to embed --help messages in binaries

This patch adds a configuration option to embed the help message within
the various executables of LTTng-tools instead of always launching the
man pager. This applies to the following commands:

    lttng --help
    lttng CMD --help
    lttng help CMD
    lttng-crash --help
    lttng-relayd --help
    lttng-sessiond --help

This is meant to be used by distributions which remove man pages or do
not have a man pager (embedded distributions, mostly). For example,
Buildroot is known to remove all man pages before it creates the final
image:

    rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man

If you pass the `--enable-embedded-help` option to the `configure`
script:

1. The configure script checks if `man` exists in the `PATH` environment
   variable. This tool is needed to generate the text versions of the
   man pages.

2. When you build LTTng-tools with `make`, the man pages are generated
   as usual (or they already exist in their troff version from a
   tarball), and their text versions are generated with `man`, with a
   fixed width set to 80 columns.

3. The text versions of the man pages are converted to literal C strings
   thanks to some `sed` magic:

   a. Replace `\` with `\\`.
   b. Replace `"` with `\"`.
   c. Add `"` prefix and `\n"` suffix to each line.

   This file is named `NAME.SECTION.h`, where `NAME` is the name of the
   man page and `SECTION` is its section. For example,
   `lttng-create.1.h`.

   I needed to add a `.PRECIOUS` target in `doc/man/Makefile.am` because
   otherwise `make` treats the troff man page files as intermediate
   files and removes them automatically. Then they need to be rebuilt
   to be installed.

4. In each C file where to show a help message, we check if the
   `--enable-embedded-help` option is set, and if so, we assign the
   included help message string to a static variable to be printed
   instead of executing the man pager.

This string added to the object file in #4 takes binary space, why is
why the `--enable-embedded-help` option is turned off by default.

The directories in the "master" `SUBDIRS` (`Makefile.am`) are reordered
so that `doc` is built before `src` since there's a direct dependency
when you pass `--enable-embedded-help`.

The `--disable-man-pages` and `--enable-embedded-help` options do not
form a valid configuration.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoExpose monitor timer interval to lttngctl and client
Jérémie Galarneau [Fri, 5 May 2017 03:53:50 +0000 (23:53 -0400)] 
Expose monitor timer interval to lttngctl and client

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTests: add placeholder symbol to allow unit tests to link
Jérémie Galarneau [Fri, 5 May 2017 03:53:27 +0000 (23:53 -0400)] 
Tests: add placeholder symbol to allow unit tests to link

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoImplement consumer ring buffer position sampling
Jérémie Galarneau [Fri, 5 May 2017 03:52:24 +0000 (23:52 -0400)] 
Implement consumer ring buffer position sampling

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd new snapshot ustctl API
Jérémie Galarneau [Fri, 5 May 2017 03:38:55 +0000 (23:38 -0400)] 
Add new snapshot ustctl API

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd kernctl RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS command
Jérémie Galarneau [Fri, 5 May 2017 03:30:56 +0000 (23:30 -0400)] 
Add kernctl RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS command

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoHandle trigger registration and unregistration in sessiond
Jérémie Galarneau [Fri, 5 May 2017 03:29:51 +0000 (23:29 -0400)] 
Handle trigger registration and unregistration in sessiond

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoStart notification subsystem thread in sessiond initialization
Jérémie Galarneau [Fri, 5 May 2017 03:27:04 +0000 (23:27 -0400)] 
Start notification subsystem thread in sessiond initialization

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoClean-up: fix comment type in lttng-consumerd.c
Jérémie Galarneau [Fri, 5 May 2017 03:24:27 +0000 (23:24 -0400)] 
Clean-up: fix comment type in lttng-consumerd.c

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd the sessiond notification-handling subsystem
Jérémie Galarneau [Fri, 5 May 2017 03:17:39 +0000 (23:17 -0400)] 
Add the sessiond notification-handling subsystem

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoClean-up: comment fix in agent_thread_manage_registration
Jérémie Galarneau [Fri, 5 May 2017 03:15:37 +0000 (23:15 -0400)] 
Clean-up: comment fix in agent_thread_manage_registration

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd client notification API
Jérémie Galarneau [Fri, 5 May 2017 03:08:47 +0000 (23:08 -0400)] 
Add client notification API

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd utils_get_count_order_u64 to utils
Jérémie Galarneau [Fri, 5 May 2017 02:59:18 +0000 (22:59 -0400)] 
Add utils_get_count_order_u64 to utils

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoImplement poll mask modification support in poll wrappers
Jérémie Galarneau [Fri, 5 May 2017 02:58:25 +0000 (22:58 -0400)] 
Implement poll mask modification support in poll wrappers

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd the container_of() macro to macro.h
Jérémie Galarneau [Fri, 5 May 2017 02:56:30 +0000 (22:56 -0400)] 
Add the container_of() macro to macro.h

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd pipe_release utils to the pipe wrapper
Jérémie Galarneau [Fri, 5 May 2017 02:54:17 +0000 (22:54 -0400)] 
Add pipe_release utils to the pipe wrapper

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd named pipe support to the pipe wrapper
Jérémie Galarneau [Fri, 5 May 2017 02:53:22 +0000 (22:53 -0400)] 
Add named pipe support to the pipe wrapper

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd non_block version of functions to UNIX socket wrapper
Jérémie Galarneau [Fri, 5 May 2017 04:14:02 +0000 (00:14 -0400)] 
Add non_block version of functions to UNIX socket wrapper

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd lttng_buffer_view util
Jérémie Galarneau [Fri, 5 May 2017 02:49:35 +0000 (22:49 -0400)] 
Add lttng_buffer_view util

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd lttng_dynamic_buffer util
Jérémie Galarneau [Fri, 5 May 2017 02:48:25 +0000 (22:48 -0400)] 
Add lttng_dynamic_buffer util

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoClean-up: fix typo in sessiond main.c comment
Jérémie Galarneau [Thu, 2 Mar 2017 22:22:08 +0000 (17:22 -0500)] 
Clean-up: fix typo in sessiond main.c comment

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoDocs: fix comment describing ust_cmd_queue
Jérémie Galarneau [Wed, 1 Mar 2017 17:15:11 +0000 (12:15 -0500)] 
Docs: fix comment describing ust_cmd_queue

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Link with no-undefined on Windows
Michael Jeanson [Thu, 2 Feb 2017 22:09:43 +0000 (17:09 -0500)] 
Port: Link with no-undefined on Windows

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: win32 DLLs don't support hidden symbols
Michael Jeanson [Thu, 26 Jan 2017 20:09:22 +0000 (15:09 -0500)] 
Port: win32 DLLs don't support hidden symbols

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: add cygwin support to endian compat
Michael Jeanson [Thu, 26 Jan 2017 20:09:21 +0000 (15:09 -0500)] 
Port: add cygwin support to endian compat

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: Remove unused headers
Michael Jeanson [Thu, 26 Jan 2017 19:55:46 +0000 (14:55 -0500)] 
Fix: Remove unused headers

This is a portability fix, these headers are unused and not available on
some platforms.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: tests: register thread for RCU operations.
Jonathan Rajotte [Thu, 26 Jan 2017 19:53:03 +0000 (14:53 -0500)] 
Fix: tests: register thread for RCU operations.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: Lazily initialize max poll set size in poll compat
Michael Jeanson [Thu, 26 Jan 2017 19:36:45 +0000 (14:36 -0500)] 
Fix: Lazily initialize max poll set size in poll compat

This was applied to the epoll implementation in commit
22dad56815ce0201c5ae7d5ef5d79cc0c6a42c5e

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: null dereference on error path for create_ctx_type
Jonathan Rajotte [Tue, 17 Jan 2017 15:08:47 +0000 (10:08 -0500)] 
Fix: null dereference on error path for create_ctx_type

When zmalloc of type->opt fail the destroy_ctx_type would result in a
null dereference.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: test_ust_data dereference of null pointer
Jonathan Rajotte [Tue, 17 Jan 2017 15:08:22 +0000 (10:08 -0500)] 
Fix: test_ust_data dereference of null pointer

Skip test on NULL value to prevent null dereference.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agox is never reused, no need to shift it
Jonathan Rajotte [Tue, 17 Jan 2017 15:07:31 +0000 (10:07 -0500)] 
x is never reused, no need to shift it

Also remove noise in scanbuild report.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: test_kernel_data dereference of null pointer
Jonathan Rajotte [Tue, 17 Jan 2017 15:02:08 +0000 (10:02 -0500)] 
Fix: test_kernel_data dereference of null pointer

Skip tests when tested struct is null.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoMan: move [SESSION] before options
Jonathan Rajotte [Fri, 13 Jan 2017 22:04:42 +0000 (17:04 -0500)] 
Man: move [SESSION] before options

The previous synopses for the live mode can cause confusion to users
since it can lead to an error while trying one of the simplest create
command for live session that the synopsis is proposing:

lttng create --live test.

Other synopsis are modified for symmetry.

Fixes #1081

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: consumerd: add missing put_subbuf for ust and kernel errors
Mathieu Desnoyers [Wed, 11 Jan 2017 20:49:49 +0000 (15:49 -0500)] 
Fix: consumerd: add missing put_subbuf for ust and kernel errors

While reading a sub-buffer, error handling need to put the sub-buffer,
else all future attempts to use the stream will trigger warnings.

The affects recent features added to UST and kernel tracing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: sessiond: only send streams to consumer once
Mathieu Desnoyers [Wed, 11 Jan 2017 20:49:48 +0000 (15:49 -0500)] 
Fix: sessiond: only send streams to consumer once

Session daemon should not send streams to consumer daemon
repeatedly when CPU hotplug is performed while doing kernel
tracing.

This causes the consumer daemon to have multiple file descriptors
on the same stream, and thus try to perform operations like reading
a sub-buffer and checking for data pending concurrently. This triggers
safety-net warnings in the kernel tracer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: consumerd main: needs to be a registered RCU thread
Mathieu Desnoyers [Thu, 19 Jan 2017 00:23:27 +0000 (19:23 -0500)] 
Fix: consumerd main: needs to be a registered RCU thread

main->lttng_consumer_destroy->destroy_data_stream_ht requires a RCU
read-side lock.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: thread_dispatch_ust_registration needs to be a RCU thread
Mathieu Desnoyers [Thu, 19 Jan 2017 00:23:26 +0000 (19:23 -0500)] 
Fix: thread_dispatch_ust_registration needs to be a RCU thread

It uses a read-side lock.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: don't abort metadata push on closed metadata
Jérémie Galarneau [Thu, 19 Jan 2017 00:23:09 +0000 (19:23 -0500)] 
Fix: don't abort metadata push on closed metadata

The failure/exit of any of the consumerd, relayd or applications
(in per-PID buffer mode) will cause the metadata closed flag to
be set.

While pushing new metadata updates to the consumerd (and relayd
in streaming/live scenarios) will fail, those conditions should
be handled in-place.

Applications are _expected_ to exit during the course of a per-PID
session. However, they will typically have pushed their metadata
to the metadata cache before doing so. The session daemon must
flush the unconsumed metadata to the consumerd in this case.

Failure to answer to the metadata request originating from the
consumerd can cause it to keep the stream lock held and, thus,
prevent the channel poll thread from cleaning up on channel
close.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agolttng-tools: remove bogus interpreter line from utils shell library
Nathan Lynch [Mon, 9 Jan 2017 22:14:28 +0000 (16:14 -0600)] 
lttng-tools: remove bogus interpreter line from utils shell library

tests/utils/utils.sh is always sourced, never executed, and
/src/bin/bash is not a typical path for a shell interpreter.  Just
delete it.

Signed-off-by: Nathan Lynch <nathan_lynch@mentor.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: consumerd: order of metadata cache vs stream lock
Mathieu Desnoyers [Mon, 9 Jan 2017 16:23:16 +0000 (11:23 -0500)] 
Fix: consumerd: order of metadata cache vs stream lock

The locking order comment in consumer.h is incorrect. First, its
description of locking order is not in sync with the comment found in
consumer-metadata-cache.h. The comment in struct consumer_metadata_cache
only states that the metadata cache lock nests inside the consumer_data
lock, and does not mention the stream lock, which implies that the
metadata cache lock does NOT nest inside the stream lock. But let's
investigate further to confirm:

* lttng_consumer_read_subbuffer() acquires the stream lock, and then
  calls lttng_ustconsumer_read_subbuffer() with stream lock held,
  and then invokes commin_one_metadata_packet(), which acquires the
  metadata cache lock.

* lttng_ustconsumer_sync_metadata() acquires the metadata stream lock,
  and calls commit_one_metadata_packet(), which takes the metadata cache
  lock.

Therefore, update the comment in consumer.h to state that the metadata
cache lock nests INSIDE the stream lock, and update
consumer_del_metadata_stream() accordingly.

This should take care of fixing the locking order reversal found by
Coverity.

CID 1368314 (#1 of 1): Thread deadlock (ORDER_REVERSAL)
CID 1368319:  Program hangs  (ORDER_REVERSAL)

Fixes: 5feafd4130 "Fix: protect the channel's metadata stream using the metadata cache lock"
Fixes: 1ea6cc572b "Fix: lock nesting order reversed"
Fixes: fb549e7ac2 "Fix: reverse channel and metadata cache lock nesting order"
Reported-by: Coverity Scan
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: add missing rcu_barrier before daemon teardown
Mathieu Desnoyers [Wed, 21 Dec 2016 22:59:38 +0000 (17:59 -0500)] 
Fix: add missing rcu_barrier before daemon teardown

When performing the "cleanup" of sessiond, consumerd, and relayd, we
destroy data structures that may still be concurrently accessed by
call_rcu worker thread.

Ensure no more work is present in the call_rcu worker thread by issuing
a rcu_barrier barrier. Note that this expects call_rcu handlers don't
chain work to other call_rcu handlers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: Add missing pthread.h include
Michael Jeanson [Mon, 5 Dec 2016 20:39:26 +0000 (15:39 -0500)] 
Fix: Add missing pthread.h include

Some libc like musl and uClibc requires explicit includes of pthread.h

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: support for older versions of Babeltrace in test script
Francis Deslauriers [Tue, 20 Dec 2016 21:31:26 +0000 (16:31 -0500)] 
Fix: support for older versions of Babeltrace in test script

A new context field was introduced in version LTTng 2.8 that is printed
by Babeltrace prior to v1.2.5. This regex thus fails to match the
output. Since the context fields are not used by the script, we create a
non-capturing group for these fields that matches on both old and new
Babeltrace.
This is causing problems on Ubuntu 14.04 Trusty when building
lttng-tools from source and using the Babeltrace package from the
official repository (v1.2.1) to run the test suite.

Also, this patch removes commented and used code in the function but
keeps the names of non-capturing groups for readability.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
CC: Philippe Proulx <pproulx@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: reverse channel and metadata cache lock nesting order
Jérémie Galarneau [Sun, 8 Jan 2017 19:29:09 +0000 (14:29 -0500)] 
Fix: reverse channel and metadata cache lock nesting order

CID 1368319:  Program hangs  (ORDER_REVERSAL)

The lttng_consumer_channel lock must be nested outside of the
metadata cache lock, as indicated in the structure's comments.

Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: only lock the metadata_cache in userspace consumers
Jérémie Galarneau [Sat, 7 Jan 2017 18:42:12 +0000 (13:42 -0500)] 
Fix: only lock the metadata_cache in userspace consumers

The kernel consumer, which re-uses the consumer_del_metadata_stream
function, has no metadata cache. Therefore, it can't be used to
protect the metadata stream (see 5feafd41).

However, only the userspace consumers invoke
consumer_metadata_cache_write() which the previous fix seeked to
protect against. It is therefore safe to omit this lock in the
kernel consumer case.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: lock nesting order reversed
Jérémie Galarneau [Sat, 7 Jan 2017 17:32:13 +0000 (12:32 -0500)] 
Fix: lock nesting order reversed

The lttng_consumer_stream lock must nest INSIDE the metadata
cache lock, as indicated in the structure's comments
(see consumer.h:340).

CID 1368314 (#1 of 1): Thread deadlock (ORDER_REVERSAL)

Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: lttng-relayd: forcefully close stream on relayd shutdown
Jonathan Rajotte [Tue, 20 Dec 2016 23:25:17 +0000 (18:25 -0500)] 
Fix: lttng-relayd: forcefully close stream on relayd shutdown

Add an "aborted" field to relay_session struct to indicate that on
shutdown pending data for a stream is no relevant and should not be
waited for.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: protect the channel's metadata stream using the metadata cache lock
Jérémie Galarneau [Wed, 21 Dec 2016 22:56:24 +0000 (17:56 -0500)] 
Fix: protect the channel's metadata stream using the metadata cache lock

The consumer_thread_data_poll and consumer_thread_metadata_poll
both access the channel's metadata stream.

During a session destruction, consumer_thread_metadata_poll will
destroy all metadata streams. However, the consumer_thread_data_poll
may still invoke a consumer_metadata_cache_write() triggered
by a "ready" subbuffer. Hence, the metadata stream must be protected
from this action by the metadata cache lock.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: double unlock of metadata mutex on error
Jérémie Galarneau [Tue, 20 Dec 2016 20:00:04 +0000 (15:00 -0500)] 
Fix: double unlock of metadata mutex on error

lttng_ustconsumer_sync_metadata must leave the metadata lock
in its initial state. Otherwise an error may result in a
double unlock in the caller.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: free previous instance of url (alloc_url) on default live url assignation
Jonathan Rajotte [Mon, 12 Dec 2016 21:39:17 +0000 (16:39 -0500)] 
Fix: free previous instance of url (alloc_url) on default live url assignation

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.045133 seconds and 4 git commands to generate.