lttng-tools.git
8 years agoFix: disable kernel event based on name and event type
Jonathan Rajotte [Mon, 21 Sep 2015 22:43:54 +0000 (18:43 -0400)] 
Fix: disable kernel event based on name and event type

The -a argument is interpreted as a zero-length event name
instead of '*' which is actually a valid wildcard event
name by itself. This simplifies how a disable command is
handled by the session daemon.

The event type can now be passed as argument and is a
new criteria while disabling kernel events. The default
is to disable for all event types.

UST and agent domain do not yet support disabling by event
type.

e.g:
# Only disable kernel event of type tracepoint.
lttng disable -a -k --tracepoint

# Only disable the event with name '*' and type syscall.
lttng disable -k '*' --syscall

# Disable all kernel event of all type.
lttng disable -a -k

Fixes #925

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: Clean-up test-crash on SIGTERM and SIGINT
Jérémie Galarneau [Mon, 21 Sep 2015 22:14:02 +0000 (18:14 -0400)] 
Tests: Clean-up test-crash on SIGTERM and SIGINT

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Possible dereference of null pointers
Michael Jeanson [Mon, 21 Sep 2015 20:31:25 +0000 (16:31 -0400)] 
Fix: Possible dereference of null pointers

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Break out of loop when searching for a domain's agent
Jérémie Galarneau [Mon, 21 Sep 2015 20:38:01 +0000 (16:38 -0400)] 
Fix: Break out of loop when searching for a domain's agent

The list command never check if a domain's agent has been found
and lists the events of every agent.

This has two direct effects:

1) Memory leak of all agents' event descriptions, except the last
2) The session daemon lists the wrong agent's events

This fix check the agent's domain and breaks out of the loop once
one is found.

Fixes #906

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: int printed as uint
Michael Jeanson [Mon, 21 Sep 2015 19:19:30 +0000 (15:19 -0400)] 
Fix: int printed as uint

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: add subdir-objects to Makefile.am
Mathieu Desnoyers [Thu, 17 Sep 2015 19:09:10 +0000 (15:09 -0400)] 
Fix: add subdir-objects to Makefile.am

Fixes the following warning introduced by the runas worker changes. Use
the same technique used in src/bin/lttng/Makefile.am.

src/common/Makefile.am:17: warning: source file 'sessiond-comm/unix.c' is in a subdirectory,
src/common/Makefile.am:17: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled.  For now, the corresponding output
automake: object file(s) will be placed in the top-level directory.  However,
automake: this behaviour will change in future Automake versions: they will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: tests: skip UST perf tests if not root
Mathieu Desnoyers [Thu, 17 Sep 2015 18:10:50 +0000 (14:10 -0400)] 
Fix: tests: skip UST perf tests if not root

Some distributions like Debian (e.g. Debian kernel 4.1.0-2-amd64) have
some grsecurity options enabled, such as CONFIG_GRKERNSEC_PERF_HARDEN.

Unfortunately, this option makes it impossible to use the SW page-fault
perf event as a normal user. It only leaves some HW events. However, we
can only use SW events within virtual machines.

Therefore, only run this test as root for now until we find a better
approach.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Check use_clone() instead of worker in run_as
Jérémie Galarneau [Fri, 18 Sep 2015 21:03:14 +0000 (17:03 -0400)] 
Fix: Check use_clone() instead of worker in run_as

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Perform rcu barrier before tearing down the run-as worker
Jérémie Galarneau [Fri, 18 Sep 2015 20:16:35 +0000 (16:16 -0400)] 
Fix: Perform rcu barrier before tearing down the run-as worker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Handle hang-up gracefully in run-as
Jérémie Galarneau [Fri, 18 Sep 2015 19:50:02 +0000 (15:50 -0400)] 
Fix: Handle hang-up gracefully in run-as

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Only log app handle release on failure
Jérémie Galarneau [Fri, 18 Sep 2015 19:35:21 +0000 (15:35 -0400)] 
Fix: Only log app handle release on failure

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: shm-path: handling of snprintf return value
Mathieu Desnoyers [Fri, 18 Sep 2015 18:46:23 +0000 (14:46 -0400)] 
Fix: shm-path: handling of snprintf return value

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Wrong format specifier used in debug statement
Jérémie Galarneau [Fri, 18 Sep 2015 18:39:13 +0000 (14:39 -0400)] 
Fix: Wrong format specifier used in debug statement

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: Swap usages of pidof for pgrep --full
Jérémie Galarneau [Fri, 18 Sep 2015 16:59:20 +0000 (12:59 -0400)] 
Tests: Swap usages of pidof for pgrep --full

Some implementations of pidof (such as the one from procps-ng)
seem immune to changing a process' name using prctl() and
overwriting argv[0]. Using preg --full works around this
problem.

In time, we should ensure every deamon publishes a PID file
which can be reliably used by the tests.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: indefinitely wait for shm buffers to be unlinked
Jérémie Galarneau [Thu, 17 Sep 2015 20:35:29 +0000 (16:35 -0400)] 
Tests: indefinitely wait for shm buffers to be unlinked

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Hide run-as functions
Jérémie Galarneau [Thu, 17 Sep 2015 18:12:34 +0000 (14:12 -0400)] 
Fix: Hide run-as functions

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Hide sessiond-comm functions
Jérémie Galarneau [Thu, 17 Sep 2015 17:49:22 +0000 (13:49 -0400)] 
Fix: Hide sessiond-comm functions

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoCleanup: remove duplicated implementation of rculfhash
Mathieu Desnoyers [Thu, 17 Sep 2015 16:48:41 +0000 (12:48 -0400)] 
Cleanup: remove duplicated implementation of rculfhash

lttng-tools features a duplicated copy of Userspace RCU rculfhash due to
interaction issues between runas clone() and internal libc mutexes.

Now that the runas implementation has been changed to use fork() and a
worker process, we don't need this work-around anymore. Remove the
duplicated rculfhash to lessen the maintenance burden.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: relayd: don't call lttng_ht_destroy in RCU read-side C.S.
Mathieu Desnoyers [Thu, 17 Sep 2015 16:48:40 +0000 (12:48 -0400)] 
Fix: relayd: don't call lttng_ht_destroy in RCU read-side C.S.

It is forbidden to call lttng_ht_destroy() within a RCU read-side
critical section.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: libc internal mutex races with run_as
Mathieu Desnoyers [Thu, 17 Sep 2015 15:30:29 +0000 (11:30 -0400)] 
Fix: libc internal mutex races with run_as

Implement a proper run_as worker process scheme to fix internal libc
mutex races. Those races lead to having the internal mutex held by
another process when clone() is called, thus hanging the clone child.

Now that we create the worker process when the parent process is
still single-threaded, we don't run into those issues. Implement a
standard fork + file descriptor passing over unnamed unix sockets rather
than the prior clone + shared file descriptor table, which was causing
issues with valgrind.

This adds a new process called "lttng-runas" for each sessiond
and consumerd process.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Hide readwrite symbols in common lib
Jérémie Galarneau [Thu, 17 Sep 2015 17:29:29 +0000 (13:29 -0400)] 
Fix: Hide readwrite symbols in common lib

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Hide pipe symbols in common lib
Jérémie Galarneau [Thu, 17 Sep 2015 17:29:11 +0000 (13:29 -0400)] 
Fix: Hide pipe symbols in common lib

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Hide daemonize symbols in common lib
Jérémie Galarneau [Thu, 17 Sep 2015 16:50:02 +0000 (12:50 -0400)] 
Fix: Hide daemonize symbols in common lib

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Hide RCU hashtable wrapper symbols
Jérémie Galarneau [Thu, 17 Sep 2015 15:29:06 +0000 (11:29 -0400)] 
Fix: Hide RCU hashtable wrapper symbols

RCU hashtable symbols shall not be exported in liblttng-ctl.so.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoClean-up: NULL free'd pointers in utils_partial_realpath
Jérémie Galarneau [Thu, 17 Sep 2015 01:11:43 +0000 (21:11 -0400)] 
Clean-up: NULL free'd pointers in utils_partial_realpath

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: prevent dangling pointer in utils_partial_realpath
Antoine Busque [Wed, 16 Sep 2015 06:58:40 +0000 (02:58 -0400)] 
Fix: prevent dangling pointer in utils_partial_realpath

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: rcu_read_unlock without parentheses has no side-effect
Jérémie Galarneau [Wed, 16 Sep 2015 23:49:56 +0000 (19:49 -0400)] 
Fix: rcu_read_unlock without parentheses has no side-effect

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: add missing test file to EXTRA_DIST
Michael Jeanson [Tue, 15 Sep 2015 14:37:48 +0000 (10:37 -0400)] 
Fix: add missing test file to EXTRA_DIST

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFormat utils.sh messages
Jonathan Rajotte [Fri, 11 Sep 2015 14:46:06 +0000 (10:46 -0400)] 
Format utils.sh messages

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: use functions from utils.sh
Jonathan Rajotte [Fri, 11 Sep 2015 14:46:05 +0000 (10:46 -0400)] 
Tests: use functions from utils.sh

v2: remove redundant information in success message.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoReport error if any disable action fails
Jonathan Rajotte [Thu, 10 Sep 2015 20:10:57 +0000 (16:10 -0400)] 
Report error if any disable action fails

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: disable all ust events
Jonathan Rajotte [Thu, 10 Sep 2015 20:10:56 +0000 (16:10 -0400)] 
Fix: disable all ust events

Handle * event correctly.

Fixes #936

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoBring back event_ust_disable_all_tracepoints
Jonathan Rajotte [Thu, 10 Sep 2015 20:10:55 +0000 (16:10 -0400)] 
Bring back event_ust_disable_all_tracepoints

Revert part of be42c96885c522f857f146fa6f7ae53856e3bed2

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: sessiond: disable: match app event by name
Jonathan Rajotte [Wed, 9 Sep 2015 21:08:20 +0000 (17:08 -0400)] 
Fix: sessiond: disable: match app event by name

The use of a simple lookup and match on event name is insufficient
to identify the corresponding ust app event.

Fixes #914

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agolttng-crash: support symlink
Jonathan Rajotte [Wed, 9 Sep 2015 17:46:17 +0000 (13:46 -0400)] 
lttng-crash: support symlink

Fixes #915

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTest: lttng-crash and ust shm path
Jonathan Rajotte [Wed, 9 Sep 2015 17:46:16 +0000 (13:46 -0400)] 
Test: lttng-crash and ust shm path

Fixes #916

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: dereferencing null index pointer
Antoine Busque [Sun, 13 Sep 2015 05:13:38 +0000 (01:13 -0400)] 
Fix: dereferencing null index pointer

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: leaking memory from strdup in lttng-crash
Antoine Busque [Sun, 13 Sep 2015 04:54:04 +0000 (00:54 -0400)] 
Fix: leaking memory from strdup in lttng-crash

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: memleak in utils_partial_realpath
Antoine Busque [Sun, 13 Sep 2015 04:18:44 +0000 (00:18 -0400)] 
Fix: memleak in utils_partial_realpath

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: double free on enable-event
Antoine Busque [Sun, 13 Sep 2015 03:48:11 +0000 (23:48 -0400)] 
Fix: double free on enable-event

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRemove dead code from filter grammar test
Jérémie Galarneau [Tue, 15 Sep 2015 17:12:31 +0000 (13:12 -0400)] 
Remove dead code from filter grammar test

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRemove dead code from ir generation filter visitor
Jérémie Galarneau [Tue, 15 Sep 2015 17:11:06 +0000 (13:11 -0400)] 
Remove dead code from ir generation filter visitor

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRemove dead code from session daemon
Jérémie Galarneau [Tue, 15 Sep 2015 17:08:50 +0000 (13:08 -0400)] 
Remove dead code from session daemon

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRemove dead code from view command
Jérémie Galarneau [Tue, 15 Sep 2015 17:06:47 +0000 (13:06 -0400)] 
Remove dead code from view command

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRemove dead code from disable-channel command
Jérémie Galarneau [Tue, 15 Sep 2015 17:03:18 +0000 (13:03 -0400)] 
Remove dead code from disable-channel command

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRemove dead code from disable-event command
Jérémie Galarneau [Tue, 15 Sep 2015 17:00:40 +0000 (13:00 -0400)] 
Remove dead code from disable-event command

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: error on no/multiple domain options
Philippe Proulx [Wed, 2 Sep 2015 17:33:52 +0000 (13:33 -0400)] 
Fix: error on no/multiple domain options

Fixes: #927
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: lttng-crash: segfault when parsing options
Philippe Proulx [Fri, 4 Sep 2015 22:47:50 +0000 (18:47 -0400)] 
Fix: lttng-crash: segfault when parsing options

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRemove dead code from the calibrate command
Jérémie Galarneau [Tue, 15 Sep 2015 15:36:04 +0000 (11:36 -0400)] 
Remove dead code from the calibrate command

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRemove dead code from add-context command
Jérémie Galarneau [Tue, 15 Sep 2015 15:01:30 +0000 (11:01 -0400)] 
Remove dead code from add-context command

This removes code ifdef-ed out from the add-context command. Code
shall either be used or ditched.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPrint relayd stream indexes
Mathieu Desnoyers [Wed, 9 Sep 2015 15:56:37 +0000 (11:56 -0400)] 
Print relayd stream indexes

In debug output, print leaking stream index information when exiting
from relay daemon.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoEnhance relayd error reporting
Mathieu Desnoyers [Wed, 9 Sep 2015 15:56:36 +0000 (11:56 -0400)] 
Enhance relayd error reporting

relay_process_data has error cases that don't print any error to the
console. Add those cases, and enhance the information provided by error
output within handle_index_data().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: relayd: handle consumerd crashes without leak
Mathieu Desnoyers [Wed, 9 Sep 2015 15:56:34 +0000 (11:56 -0400)] 
Fix: relayd: handle consumerd crashes without leak

We can be clever about indexes partially received in cases where we
received the data socket part, but not the control socket part: since
we're currently closing the stream on behalf of the control socket, we
*know* there won't be any more control information for this socket.
Therefore, we can destroy all indexes for which we have received only
the file descriptor (from data socket). This takes care of consumerd
crashes between sending the data and control information for a packet.
Since those are sent in that order, we take care of consumerd crashes.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: LPOLLHUP and LPOLLERR when there is still data in pipe/socket
Mathieu Desnoyers [Wed, 9 Sep 2015 15:56:33 +0000 (11:56 -0400)] 
Fix: LPOLLHUP and LPOLLERR when there is still data in pipe/socket

The event mask returned by poll/epoll is a bitwise mask made of all the
events observed. On bidirectional sockets, there are cases where
combinations of LPOLLHUP/LPOLLERR and LPOLLIN/LPOLLPRI can be raised at
the same time.

Currently the overall behavior in sessiond, consumerd and relayd is to
handle LPOLLHUP or LPOLLERR immediately, whether or not there is still
data to read in the socket. Unfortunately, this behavior may discard the
last information made available on the pipe or socket.

Audit all uses of LPOLLHUP and LPOLLERR on sockets on which we expect
data to ensure that we deal with LPOLLIN or LPOLLPRI, and catch the
hangup when read or recvmsg returns 0. Keep the LPOLLHUP and LPOLLERR
handling, but only when LPOLLIN is not raised, just in case some
unforeseen error happens when sending the reply.

This is one correct case where we can handle LPOLLHUP and LPOLLERR
directly without caring about LPOLLIN: sockets where we are expected to
write and then read the reply (e.g. command sockets). It is then OK
for a dedicated thread to watch for LPOLLHUP and LPOLLERR.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: double RCU unlock on event_agent_disable_all
Jonathan Rajotte [Tue, 8 Sep 2015 22:32:12 +0000 (18:32 -0400)] 
Fix: double RCU unlock on event_agent_disable_all

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: unbalanced RCU read-side lock in enable event command
Mathieu Desnoyers [Mon, 7 Sep 2015 14:36:09 +0000 (10:36 -0400)] 
Fix: unbalanced RCU read-side lock in enable event command

The event validation fails, an unpaired RCU unlock is performed, thus
underflowing the RCU nesting counter.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoAdd rcu_read_ongoing() assertions around process_client_msg
Mathieu Desnoyers [Mon, 7 Sep 2015 14:36:08 +0000 (10:36 -0400)] 
Add rcu_read_ongoing() assertions around process_client_msg

process_client_msg ensures that RCU read-side lock should not be held
when calling it. Validate this using rcu_read_ongoing() at the entry and
exit points of this function. This allows us to catch unbalanced RCU
read-side lock within commands quickly.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoClean-up and simplify event_agent_disable_all
Jérémie Galarneau [Sun, 6 Sep 2015 23:40:42 +0000 (19:40 -0400)] 
Clean-up and simplify event_agent_disable_all

event_agent_disable_all contains comments which make no sense since
they were blindly copy-pasted from event_agent_enable_all.

Also add an error_unlock label instead of open coding the unlock
on error.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoDocument locking assumption of agent_find_event()
Jérémie Galarneau [Sun, 6 Sep 2015 23:40:13 +0000 (19:40 -0400)] 
Document locking assumption of agent_find_event()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: disable agent events by name
Philippe Proulx [Wed, 2 Sep 2015 16:55:47 +0000 (12:55 -0400)] 
Fix: disable agent events by name

The event_agent_disable() function only disables the first
agent event matching a given name. However, if multiple agent
events exist with different loglevels, but share the same name,
we want all of them to be disabled at once.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agosessiond: add loglevels_match()
Philippe Proulx [Wed, 2 Sep 2015 15:31:35 +0000 (11:31 -0400)] 
sessiond: add loglevels_match()

UST and agent event loglevel matching algorithm is the same
so factor out this code into a common utility.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: include loglevel type in agent event's primary key
Philippe Proulx [Wed, 2 Sep 2015 05:54:23 +0000 (01:54 -0400)] 
Fix: include loglevel type in agent event's primary key

Refs: #913

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: include loglevel type in UST event's primary key
Philippe Proulx [Wed, 2 Sep 2015 02:53:30 +0000 (22:53 -0400)] 
Fix: include loglevel type in UST event's primary key

Refs: #913

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agosessiond: use `loglevel_value` and `loglevel_type` names
Philippe Proulx [Wed, 2 Sep 2015 01:52:40 +0000 (21:52 -0400)] 
sessiond: use `loglevel_value` and `loglevel_type` names

By using the `loglevel_value` and `loglevel_type` names instead
of `loglevel` for one or the other, some unsettling
inconsistencies are exposed.

This patch only changes the names to show the weird stuff, e.g.:

    key.loglevel_type = loglevel_value;

A future patch will fix this.

The only `loglevel` names left untouched are those in public headers
as well as those in the tools<->UST ABI.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: kernel wildcards
Mathieu Desnoyers [Fri, 4 Sep 2015 23:53:19 +0000 (19:53 -0400)] 
Tests: kernel wildcards

Fixes #920

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: fix wildcard test path
Jérémie Galarneau [Sun, 6 Sep 2015 17:52:00 +0000 (13:52 -0400)] 
Tests: fix wildcard test path

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agodoc: document untrack command in lttng(1)
Philippe Proulx [Tue, 1 Sep 2015 22:04:51 +0000 (18:04 -0400)] 
doc: document untrack command in lttng(1)

Refs: #917

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agodoc: document track command in lttng(1)
Philippe Proulx [Tue, 1 Sep 2015 22:00:49 +0000 (18:00 -0400)] 
doc: document track command in lttng(1)

Refs: #917

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agoRemove dot after enable-event message
Jérémie Galarneau [Sun, 6 Sep 2015 03:51:33 +0000 (23:51 -0400)] 
Remove dot after enable-event message

The other domains' enable event confirmation messages don't have
a trailing dot. Removing this one for consistency.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: don't print the default channel name when enabling agent events
Antoine Busque [Wed, 2 Sep 2015 00:21:00 +0000 (20:21 -0400)] 
Fix: don't print the default channel name when enabling agent events

Enabling an event in the python domain erroneously reported the
channel as being the default `channel0`. Instead, don't report the
channel name when enabling an event in an agent domain.

Fixes: #910
Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: fail gracefully on --exclude on unsupported domains
Antoine Busque [Tue, 1 Sep 2015 23:48:43 +0000 (19:48 -0400)] 
Fix: fail gracefully on --exclude on unsupported domains

Trying to use event name exclusions on unsupported domains other than
kernel (i.e. log4j, jul, and python) would hang the client. Instead,
report the error appropriately.

Fixes: #909
Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: initialize live_timer to 0 for snapshot session
Antoine Busque [Tue, 1 Sep 2015 23:12:28 +0000 (19:12 -0400)] 
Fix: initialize live_timer to 0 for snapshot session

The live timer was being initialized to -1 for snapshot sessions,
instead of the expected default value of 0 used elsewhere in the code.

Fixes #879

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: correct mismatched function signatures
Antoine Busque [Tue, 1 Sep 2015 22:53:57 +0000 (18:53 -0400)] 
Fix: correct mismatched function signatures

The extern declaration of `_lttng_create_session_ext` in `create.c`
had a superfluous `live_timer` parameter not present in the actual
function definition in `lttng_ctl.c`. The -1 value with which it was
called was therefore unused.

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoClearer error reporting when failing to launch session daemon
Jérémie Galarneau [Sun, 6 Sep 2015 03:03:51 +0000 (23:03 -0400)] 
Clearer error reporting when failing to launch session daemon

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoDaemonize sessiond on `lttng create`
Philippe Proulx [Thu, 27 Aug 2015 15:52:33 +0000 (11:52 -0400)] 
Daemonize sessiond on `lttng create`

Since the session daemon forked by `lttng create` shares its
standard output/error FDs when not using `--daemonize`, redirecting
the standard output/error of this command to another program "hangs"
because the session daemon never terminates.

Example that's not working (when sessiond is not running):

    lttng create | wc

or:

    lttng 2>&1 | wc

Using sessiond's `--daemonize` option makes it close its FDs. This
option also ensures that when the sessiond process exits, it has forked
itself as a daemon and is ready to accept commands. Therefore we don't
need to catch SIGCHLD and SIGUSR1; just waitpid() on sessiond's PID and
make sure it exited normally and with an exit status of 0 to continue.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: consumer signal handling race
Mathieu Desnoyers [Sat, 5 Sep 2015 23:58:29 +0000 (19:58 -0400)] 
Fix: consumer signal handling race

If a signal comes in after ctx has been destroyed, it will try to use a
closed file descriptor.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: list_ust_events(): dangling pointer
Philippe Proulx [Wed, 26 Aug 2015 17:40:18 +0000 (13:40 -0400)] 
Fix: list_ust_events(): dangling pointer

Fixes #908

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: MI: close domain when listing multiple agent domains
Philippe Proulx [Sat, 22 Aug 2015 06:47:53 +0000 (02:47 -0400)] 
Fix: MI: close domain when listing multiple agent domains

Without this patch, each agent domain gets nested under
the previous one.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: expand UST wildcard tests, move to regression/tools
Mathieu Desnoyers [Fri, 4 Sep 2015 23:53:18 +0000 (19:53 -0400)] 
Tests: expand UST wildcard tests, move to regression/tools

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: kernel filtering
Mathieu Desnoyers [Fri, 4 Sep 2015 23:00:14 +0000 (19:00 -0400)] 
Tests: kernel filtering

Requires the new lttng-test.ko lttng-modules test module.

Fixes #921

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: use pid element instead of process element
Jonathan Rajotte [Fri, 4 Sep 2015 22:02:48 +0000 (18:02 -0400)] 
Fix: use pid element instead of process element

v2: Include change to xsd. Looks like I forgot to squash it. I'll have to make
an offering to the git reflog god on this one.

For stable 2.7

This revert part of changes introduced by [1] and [2].

The use of process element break the existing MI xml api.

[1] 46ef4d0715faeef52cd2242b5b895c74507e223a
[2] a585578f837d992f00eba4f090c8ba251d9de94e

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: race between kconsumerd and sessiond on tear down
Jonathan Rajotte [Thu, 3 Sep 2015 21:48:36 +0000 (17:48 -0400)] 
Fix: race between kconsumerd and sessiond on tear down

v2: minimize indentation by using return on condition.

Kconsumerd and sessiond both have reference on lttng-module. This can lead to a race
on modprobe_remove_lttng_all which might fail to unload modules due to
certain modules not having a ref count equal to zero at the time.

waitpid is used to force a synchronization on the child (kconsumer) termination.

This also have been applied to ust consumers for the sake of consistency.

Fixes: #878
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Buggy string comparison in ust registry ht_match_event
Jérémie Galarneau [Sat, 5 Sep 2015 19:35:42 +0000 (15:35 -0400)] 
Fix: Buggy string comparison in ust registry ht_match_event

The second strncmp compares the first "strlen(event->signature) != 0"
characters of the event signatures because of a missing parenthesis.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Bad cast of lttng_kernel_instrumentation to lttng_event_type
Jérémie Galarneau [Sat, 5 Sep 2015 19:33:54 +0000 (15:33 -0400)] 
Fix: Bad cast of lttng_kernel_instrumentation to lttng_event_type

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Implicit cast from lttng_loglevel_type to lttng_ust_loglevel_type
Jérémie Galarneau [Sat, 5 Sep 2015 19:23:32 +0000 (15:23 -0400)] 
Fix: Implicit cast from lttng_loglevel_type to lttng_ust_loglevel_type

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: lttng-crash: remove tmp working directory
Jonathan Rajotte [Thu, 3 Sep 2015 21:52:07 +0000 (17:52 -0400)] 
Fix: lttng-crash: remove tmp working directory

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoClean up: Coding style conformance adjustments in lttng-crash.c
Jérémie Galarneau [Sat, 5 Sep 2015 17:55:51 +0000 (13:55 -0400)] 
Clean up: Coding style conformance adjustments in lttng-crash.c

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: lttng-crash: DIR leak in delete_trace() on error
Jérémie Galarneau [Sat, 5 Sep 2015 17:53:31 +0000 (13:53 -0400)] 
Fix: lttng-crash: DIR leak in delete_trace() on error

Implement a single return point in delete_trace() which ensures
that trace_dir is not leaked on error.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Possible passing of NULL pointer to memcpy()
Jérémie Galarneau [Sat, 5 Sep 2015 16:02:10 +0000 (12:02 -0400)] 
Fix: Possible passing of NULL pointer to memcpy()

_cmd_enable_event() will not jump to the error label in case of
memory allocation of the filter bytecode copy. This causes the NULL
return of zmalloc to be used by memcpy() directly.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Overwrite of ret in relay_recv_metadata
Jérémie Galarneau [Sat, 5 Sep 2015 15:57:52 +0000 (11:57 -0400)] 
Fix: Overwrite of ret in relay_recv_metadata

relay_recv_metadata() interchangeably uses ret and size_ret.
This causes ret to take various (positive) values in case
of success, most often corresponding to the size of the metadata
padding which was written during the call.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoSilence undefined return value warning
Jérémie Galarneau [Sat, 5 Sep 2015 15:44:01 +0000 (11:44 -0400)] 
Silence undefined return value warning

clang-analyzer complains that "ret" may be returned uninitialized
which can't happen with a valid session configuration. For this to
occur, either libxml2 would have to return a bogus ChildElementCount
(return non-zero when there a actually no child nodes) _or_ the node
would have children of an unexpected type, which would be catched by
the validation performed against the XSD.

Nonetheless, the value is initialized here to silence this warning.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoSilence use-after-free static analysis warning
Jérémie Galarneau [Sat, 5 Sep 2015 15:35:43 +0000 (11:35 -0400)] 
Silence use-after-free static analysis warning

clang-analyzer complains that cds_list_for_each_entry_safe()
makes use of "wait_node" after free. However, wait_node is only
used in __typeof__().

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Wait for in-flight data before closing a stream
Jérémie Galarneau [Sat, 5 Sep 2015 02:04:12 +0000 (22:04 -0400)] 
Fix: Wait for in-flight data before closing a stream

A stream's closing conditions are evaluated in three places:
    1) When a close command is received
    2) When the control connection owning it is closed
    3) The stream has received all of its data following
       a close request.

These checks are performed in try_stream_close().

A known downside of this approach is that a stream will never
be closed if it has not received all of its data.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: unpublish stream on close
Mathieu Desnoyers [Fri, 4 Sep 2015 19:44:23 +0000 (15:44 -0400)] 
Fix: unpublish stream on close

Fixes a race where data connection can still add indexes after close,
preventing graceful teardown of the stream.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: lttng-crash: fd leak
Jonathan Rajotte [Thu, 3 Sep 2015 21:52:06 +0000 (17:52 -0400)] 
Fix: lttng-crash: fd leak

At the same time, make sure to have a single exit-point in copy_file().

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Invalid parameter error reported when untracking PID
Jérémie Galarneau [Fri, 4 Sep 2015 21:34:44 +0000 (17:34 -0400)] 
Fix: Invalid parameter error reported when untracking PID

The LTTng client reports an "Invalid parameter" error if a PID is
untracked from the userspace domain before any PID is tracked in that
domain.

Fixes #931

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: kernel track/untrack error handling
Mathieu Desnoyers [Wed, 2 Sep 2015 14:45:07 +0000 (10:45 -0400)] 
Fix: kernel track/untrack error handling

Fixes #918

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Python agent tests are always skipped
Jonathan Rajotte [Mon, 24 Aug 2015 15:08:29 +0000 (08:08 -0700)] 
Fix: Python agent tests are always skipped

v2: Change the configure report section to emulate the java ust agent test
reporting.

Introduce --enable-test-python{2,3}-agent and --enable-test-python-agent-all
flag on configure.

Configure searches for the python agent for both Python 2 and 3 and
enables or skips their associated tests based on the result.

When using the --enable-test-python{2,3}-agent & --enable-test-python-agent-all
flags, a strict checks on tests dependancies is performed and fails the
configure instead of simply disabling the tests.

--disable* flags can be used to force tests skipping.

Also fixes a minor bug in agent test on enabling event with filtering.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: Fix flaky live test client
Jérémie Galarneau [Fri, 4 Sep 2015 01:45:10 +0000 (21:45 -0400)] 
Tests: Fix flaky live test client

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Announce empty streams on live attach
Jérémie Galarneau [Fri, 4 Sep 2015 01:43:26 +0000 (21:43 -0400)] 
Fix: Announce empty streams on live attach

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