lttng-tools.git
11 years agoUpdate version to v2.2.0 v2.2.0
David Goulet [Tue, 25 Jun 2013 20:40:13 +0000 (16:40 -0400)] 
Update version to v2.2.0

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: build path for unit test to build out of tree
David Goulet [Tue, 25 Jun 2013 21:25:04 +0000 (17:25 -0400)] 
Fix: build path for unit test to build out of tree

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: if relayd is unreachable, disable consumer for the session
David Goulet [Tue, 25 Jun 2013 20:25:06 +0000 (16:25 -0400)] 
Fix: if relayd is unreachable, disable consumer for the session

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: possible infinite loop in disable ust event
David Goulet [Tue, 25 Jun 2013 19:24:35 +0000 (15:24 -0400)] 
Fix: possible infinite loop in disable ust event

Fixes #575

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: don't enable a channel if a session was already started
David Goulet [Tue, 25 Jun 2013 18:15:41 +0000 (14:15 -0400)] 
Fix: don't enable a channel if a session was already started

This removes also the check done to start the session if it was started
before.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: bad type for the relayd id
David Goulet [Tue, 25 Jun 2013 17:39:46 +0000 (13:39 -0400)] 
Fix: bad type for the relayd id

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: add debug statement in kernel flush metadata
David Goulet [Tue, 25 Jun 2013 17:37:59 +0000 (13:37 -0400)] 
Fix: add debug statement in kernel flush metadata

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: destroy default created channel if add-context fails
David Goulet [Tue, 25 Jun 2013 16:30:59 +0000 (12:30 -0400)] 
Fix: destroy default created channel if add-context fails

Fixes #554

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: clarify tracefile size/count in lttng.1 man
David Goulet [Tue, 25 Jun 2013 16:05:11 +0000 (12:05 -0400)] 
Fix: clarify tracefile size/count in lttng.1 man

Fixes #572

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: don't stop a session that was not previously started
David Goulet [Tue, 25 Jun 2013 16:03:20 +0000 (12:03 -0400)] 
Fix: don't stop a session that was not previously started

Fixes #567

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: update lttng.1 man page
David Goulet [Tue, 25 Jun 2013 15:34:36 +0000 (11:34 -0400)] 
Fix: update lttng.1 man page

Fixes #571

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: bad protocol flow between sessiond and consumerd
David Goulet [Tue, 4 Jun 2013 21:46:33 +0000 (17:46 -0400)] 
Fix: bad protocol flow between sessiond and consumerd

Also, the error handling was wrong for some error path.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: kernel memory leak in error path
David Goulet [Tue, 25 Jun 2013 14:55:21 +0000 (10:55 -0400)] 
Fix: kernel memory leak in error path

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoUpdate version to v2.2.0-rc3 v2.2.0-rc3
David Goulet [Thu, 20 Jun 2013 18:35:31 +0000 (14:35 -0400)] 
Update version to v2.2.0-rc3

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: --disable-static option
David Goulet [Thu, 20 Jun 2013 17:39:41 +0000 (13:39 -0400)] 
Fix: --disable-static option

Fixes #562

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: add missing file for make dist
David Goulet [Thu, 20 Jun 2013 17:30:39 +0000 (13:30 -0400)] 
Fix: add missing file for make dist

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: channel and stream leak in consumerd
David Goulet [Tue, 18 Jun 2013 20:07:02 +0000 (16:07 -0400)] 
Fix: channel and stream leak in consumerd

Multiple error paths were possibly leaking channel and stream structure
in the lttng-consumerd.

This has been detected by the stress test killing the relayd randomly
during a long period of time.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: consumer add channel return value was positive on error
David Goulet [Wed, 19 Jun 2013 20:21:41 +0000 (16:21 -0400)] 
Fix: consumer add channel return value was positive on error

Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: wrong check after malloc in buffer registry
David Goulet [Wed, 19 Jun 2013 20:17:10 +0000 (16:17 -0400)] 
Fix: wrong check after malloc in buffer registry

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: change an ERR message to a DBG
David Goulet [Wed, 19 Jun 2013 19:44:51 +0000 (15:44 -0400)] 
Fix: change an ERR message to a DBG

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Fix wrong number of tests in thread stall as root test
Christian Babeux [Wed, 19 Jun 2013 19:22:05 +0000 (15:22 -0400)] 
Tests: Fix wrong number of tests in thread stall as root test

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: set +x to test helper script
David Goulet [Wed, 19 Jun 2013 19:18:53 +0000 (15:18 -0400)] 
Fix: set +x to test helper script

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTest: add new stress test that kills the relayd randomly
David Goulet [Wed, 19 Jun 2013 18:45:24 +0000 (14:45 -0400)] 
Test: add new stress test that kills the relayd randomly

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoUsing LTTNG_HOME environment variable if exists, with fallback to HOME
Amit Margalit [Thu, 13 Jun 2013 09:35:13 +0000 (12:35 +0300)] 
Using LTTNG_HOME environment variable if exists, with fallback to HOME

11 years agoFix: remove use of stat()
Mathieu Desnoyers [Tue, 18 Jun 2013 20:00:37 +0000 (16:00 -0400)] 
Fix: remove use of stat()

1019896 Time of check time of use
In utils_mkdir_recursive: A check occurs on a file's attributes before
the file is used in a privileged operation, but things may have changed
(CWE-367)

mkdir() is already doing the EEXIST check.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: out of bound strcpy
Mathieu Desnoyers [Tue, 18 Jun 2013 19:51:37 +0000 (15:51 -0400)] 
Fix: out of bound strcpy

1019904 Copy into fixed size buffer
In add_context: A source buffer of statically unknown size is copied
into a fixed-size destination buffer (CWE-120)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoRemove logically dead code
Mathieu Desnoyers [Tue, 18 Jun 2013 19:38:57 +0000 (15:38 -0400)] 
Remove logically dead code

1019963 Logically dead code
In list_sessions: Code can never be reached because of a logical
contradiction (CWE-561)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: handle close return value
Mathieu Desnoyers [Tue, 18 Jun 2013 19:34:31 +0000 (15:34 -0400)] 
Fix: handle close return value

1019968 Unchecked return value
In lttng_health_check: Value returned from a function is not checked for
errors before being used (CWE-252)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoRemove useless if() check
Mathieu Desnoyers [Tue, 18 Jun 2013 19:33:05 +0000 (15:33 -0400)] 
Remove useless if() check

1022350 Dereference before null check
In ust_registry_session_destroy: All paths that lead to this null
pointer comparison already dereference the pointer earlier (CWE-476)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: goto error_fatal on lttng_kconsumer_recv_cmd errors
Mathieu Desnoyers [Tue, 18 Jun 2013 19:30:41 +0000 (15:30 -0400)] 
Fix: goto error_fatal on lttng_kconsumer_recv_cmd errors

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: goto error_fatal on lttng_ustconsumer_recv_cmd errors
Mathieu Desnoyers [Tue, 18 Jun 2013 19:30:06 +0000 (15:30 -0400)] 
Fix: goto error_fatal on lttng_ustconsumer_recv_cmd errors

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: unnecessarily large memory allocation
Mathieu Desnoyers [Tue, 18 Jun 2013 18:58:46 +0000 (14:58 -0400)] 
Fix: unnecessarily large memory allocation

1019911 Wrong sizeof argument
In consumer_thread_data_poll: The sizeof operator is invoked on the
wrong argument (CWE-569)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: comparing array against NULL
Mathieu Desnoyers [Tue, 18 Jun 2013 18:51:15 +0000 (14:51 -0400)] 
Fix: comparing array against NULL

1019939 Array compared against 0
In process_client_msg: Array compared against NULL pointer (CWE-398)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: Remove reference to lttng-probe-lttng kernel module
Jérémie Galarneau [Wed, 5 Jun 2013 19:39:15 +0000 (15:39 -0400)] 
Fix: Remove reference to lttng-probe-lttng kernel module

The lttng-probe-lttng module was removed as part of lttng-modules
commit 662ed1665428b38ee00d4be5751581108bf35390

Fixes #553

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: memleak in liblttng-ctl visit_node_load()
Mathieu Desnoyers [Fri, 14 Jun 2013 20:34:56 +0000 (16:34 -0400)] 
Fix: memleak in liblttng-ctl visit_node_load()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: memleak in the UST registry
David Goulet [Fri, 14 Jun 2013 18:37:50 +0000 (14:37 -0400)] 
Fix: memleak in the UST registry

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: add missing free causing a memleak
David Goulet [Fri, 14 Jun 2013 17:35:27 +0000 (13:35 -0400)] 
Fix: add missing free causing a memleak

Also remove a unused variable in the ust registry event structure.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: memleaks in channel/event notify
David Goulet [Fri, 14 Jun 2013 16:14:53 +0000 (12:14 -0400)] 
Fix: memleaks in channel/event notify

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: sanitize wait queue in the dispatch thread
David Goulet [Thu, 6 Jun 2013 16:37:01 +0000 (12:37 -0400)] 
Fix: sanitize wait queue in the dispatch thread

This is to avoid memory leaks when the notify socket is never received
thus cleaning the wait node for command socket that are invalid.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoImplement health check for app registration dispatch
Mathieu Desnoyers [Fri, 14 Jun 2013 12:02:27 +0000 (08:02 -0400)] 
Implement health check for app registration dispatch

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoImplement health check for app notification thread
Mathieu Desnoyers [Fri, 14 Jun 2013 11:51:50 +0000 (07:51 -0400)] 
Implement health check for app notification thread

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: hash table cleanup call_rcu deadlock
Mathieu Desnoyers [Fri, 14 Jun 2013 11:44:52 +0000 (07:44 -0400)] 
Fix: hash table cleanup call_rcu deadlock

Implement hash table cleanup thread so HT cleanup never deadlocks on
resize in progress.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix ua_chan assert
Mathieu Desnoyers [Thu, 13 Jun 2013 21:07:21 +0000 (17:07 -0400)] 
Fix ua_chan assert

delete_ust_app() can remove a channel objd from the hash table
concurrently with notify

Fix #560

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: poll compat layer reallocation new size
David Goulet [Thu, 6 Jun 2013 19:30:14 +0000 (15:30 -0400)] 
Fix: poll compat layer reallocation new size

The size was doubled but in fact it should have been checked for the
maximum between the number of fd doubled and the alloc size doubled
(divised by two when shrinking the buffer).

Same goes for the shrink process. For that, get_count_order_u32() is
added to utils.c/.h.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: remove nonblock flag of sessiond socket in consumer
David Goulet [Tue, 4 Jun 2013 19:56:43 +0000 (15:56 -0400)] 
Fix: remove nonblock flag of sessiond socket in consumer

There is no need for non blocking socket. Furthermore, we have observed
unstable behaviors with a non blocking side (consumer) and a blocking
side (sessiond).

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: add missing ht iter node assignment in channel thread
David Goulet [Tue, 4 Jun 2013 16:09:49 +0000 (12:09 -0400)] 
Fix: add missing ht iter node assignment in channel thread

Fixes #547

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Missing RCU locks on access to consumerd's channel ht
Jérémie Galarneau [Tue, 4 Jun 2013 03:19:59 +0000 (23:19 -0400)] 
Fix: Missing RCU locks on access to consumerd's channel ht

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoRevert "Improve channel listing output format"
David Goulet [Tue, 4 Jun 2013 14:36:57 +0000 (10:36 -0400)] 
Revert "Improve channel listing output format"

This changed the text output *after* rc1. We'll keep this in the back
burner for 2.3.

This reverts commit e78de861055e6288d11348866681d1373ed81aec.

11 years agoFix: add more conditions and a lock to metadata cache flushed
David Goulet [Mon, 3 Jun 2013 17:24:10 +0000 (13:24 -0400)] 
Fix: add more conditions and a lock to metadata cache flushed

Some more conditions applies to return if the metadata cache is indeed
flushed. If no metadata stream is found or the endpoint status is set to
something other than ACTIVE, this means the channel is being (or will
be) destroyed thus the metadata cache can't be updated so is indeed
"flushed".

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: set metadata closed on a push/close metadata error
David Goulet [Mon, 3 Jun 2013 17:13:55 +0000 (13:13 -0400)] 
Fix: set metadata closed on a push/close metadata error

Check the metadata closed flag before pushing and closing the metadata
on the consumer side. On any error from those two actions, the closed
flag is set to indicate to stop using the metadata registry until a
destroy is done.

Also, before creating a metadata, a check is done to see if the registry
metadata was closed previously or else a new metadata key is created and
the old values from the previous channel in the registry are used
causing a bad state on the consumer.

With per UID buffers, the metadata cache is shared accross multiple
applications so if the metadata buffers were deleted on the consumer for
whatever reasons, we must STOP using it or else undesired behaviors have
been observed such as causing synchronization issues between the state
of the consumer and sessiond.

A destroy session command will wipe the faulty metadata.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: skip metadata flushed check if write failed
David Goulet [Mon, 3 Jun 2013 17:05:22 +0000 (13:05 -0400)] 
Fix: skip metadata flushed check if write failed

On a metadata cache write failure, we now skip the metadata flushed
check or else an infinite loop could have been possible.

Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: remove one too many metadata refcount increment
David Goulet [Wed, 29 May 2013 16:19:57 +0000 (12:19 -0400)] 
Fix: remove one too many metadata refcount increment

The refcount increment is removed from the add metadata stream function
so for both kernel and UST, the increment is done once the stream is
allocated and the channel reference is set.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: add missing buffer registry cleanup on error
David Goulet [Tue, 28 May 2013 21:58:44 +0000 (17:58 -0400)] 
Fix: add missing buffer registry cleanup on error

Fixes #542

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: dereference after NULL check
David Goulet [Tue, 28 May 2013 19:07:30 +0000 (15:07 -0400)] 
Fix: dereference after NULL check

From coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: remove dead code
David Goulet [Tue, 28 May 2013 19:05:04 +0000 (15:05 -0400)] 
Fix: remove dead code

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: wrong size in memcpy of kernel channel padding
David Goulet [Tue, 28 May 2013 18:57:05 +0000 (14:57 -0400)] 
Fix: wrong size in memcpy of kernel channel padding

Issue 1019925 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: typo when closing the consumer client socket
David Goulet [Tue, 28 May 2013 18:50:21 +0000 (14:50 -0400)] 
Fix: typo when closing the consumer client socket

Issue 1019917 of covertiry scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Add multi session per UID with 5 app in streaming mode
David Goulet [Thu, 23 May 2013 15:03:42 +0000 (11:03 -0400)] 
Tests: Add multi session per UID with 5 app in streaming mode

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Add stress test for multi session per UID
David Goulet [Wed, 22 May 2013 19:17:17 +0000 (15:17 -0400)] 
Tests: Add stress test for multi session per UID

For this test, 10 applications are used with 5 sessions set with per UID
buffers.

A helper script is also added which launch applications with given
parameters. A README file is also present to help developers/users use
the stress tests correctly.

Stress tests save the stderr/stdout of the session daemon in a log file
and core dump created using the name found in core_pattern (in /proc).

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: get consumer lock before closing/pushing metadata
David Goulet [Tue, 28 May 2013 18:25:27 +0000 (14:25 -0400)] 
Fix: get consumer lock before closing/pushing metadata

This is to ensure the validity of the metadata stream in the channel
before closing or pushing the metadata on it.

Fixes #536

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: set channel key to message on notify channel
David Goulet [Tue, 28 May 2013 17:06:38 +0000 (13:06 -0400)] 
Fix: set channel key to message on notify channel

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: increment channel refcount on add_stream
Julien Desfossez [Thu, 23 May 2013 23:07:20 +0000 (19:07 -0400)] 
Fix: increment channel refcount on add_stream

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: error handling in kernel add_channel
Julien Desfossez [Thu, 23 May 2013 21:07:08 +0000 (17:07 -0400)] 
Fix: error handling in kernel add_channel

consumer_add_channel can return an error, it needs to be handled. Also,
init_kernel_tracing returns a positive lttng_error_code on error, so the
check in start_kernel_session needs to be for ret != 0.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: close wait_fd on kernel tracing
Julien Desfossez [Thu, 23 May 2013 20:13:35 +0000 (16:13 -0400)] 
Fix: close wait_fd on kernel tracing

The wait_fd in the kernel consumer streams was not closed causing a leak
of FDs in the consumer and never triggering the teardown mechanism in
the kernel tracer. This applies for metadata and data stream.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Fix possible segfault in health check thread exit test
Christian Babeux [Wed, 22 May 2013 20:29:33 +0000 (16:29 -0400)] 
Tests: Fix possible segfault in health check thread exit test

The testpoints in the thread_manage_clients and thread_manage_apps are
called after a rcu_register_thread() call. The testpoints were not
unregistering their respective thread which could later on cause a
segfault when shutting down the session daemon.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: use lttng pipe to send new stream to thread
David Goulet [Tue, 14 May 2013 17:51:07 +0000 (13:51 -0400)] 
Fix: use lttng pipe to send new stream to thread

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoChange consumer_metadata_pipe to be a lttng_pipe
David Goulet [Tue, 14 May 2013 15:27:26 +0000 (11:27 -0400)] 
Change consumer_metadata_pipe to be a lttng_pipe

The read() call in the metadata thread is also changed to use the lttng
pipe read wrapper.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoChange consumer_data_pipe to be a lttng_pipe
David Goulet [Tue, 14 May 2013 15:00:22 +0000 (11:00 -0400)] 
Change consumer_data_pipe to be a lttng_pipe

Also, an important change here is that this pipe is no longer in non
block mode. Before sending stream's pointer over this pipe, only one
byte was written thus making it unlikely to fail in a read/write race
condition between threads. Now, 4 bytes are written so keeping this pipe
non block with threads is a bit of a "looking for trouble situation".

The lttng pipe wrappers make sure that the read and write side are
synchronized between threads using a mutex for each side. Furthermore,
the read and write handle partial I/O and EINTR meaning that once the
call returns we are sure that either everything was read/written or an
error occured thus making it not possible for the read side to block
indefinitely after a poll event.

Fixes #475

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd wrappers for pipe
David Goulet [Fri, 10 May 2013 16:02:37 +0000 (12:02 -0400)] 
Add wrappers for pipe

This is to help use pipes in a way where partial read/write and EINTR
are handled in one single call site.

Two new files are created, pipe.c/.h which are part of libcommon. The
open, close, read_close, write_close, read and write calls are
implemented using a custom lttng_pipe data structure and protected by
operation's mutex. A destroy function is also available to cleanup
memory once done with a pipe.

The motivation behind this patch is for some upcoming fixes that deals
with a race condition between read and write on a pipe in the consumer.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: increment UST channel refcount at stream creation
David Goulet [Fri, 17 May 2013 18:08:14 +0000 (14:08 -0400)] 
Fix: increment UST channel refcount at stream creation

Having the channel refcount incremented only when the stream is sent to a
thread could triggered a segfault with a race between a channel destroyed by
the channel thread and the stream pointers being inflight in the thread pipe.

Once read from the pipe, the streams are added to the data thread poll set and
immediately destroyed since the channel has hung up previously but the flush
buffer segfaulted on the channel that was already deleted by the channel thread
with a refcount set to 0.

This is fixed by incrementing the channel refcount once the stream is created
and the channel reference is set to it. This is done *before* the channel
object is visible in the channel thread. Now the channel thread detects the
hang up but will not destroy the channel because of the refcount > 0. The
channel cleanup will be done by the last stream hanging up.

Fixes #530

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: update tracer version in lttng-sessiond.8 and lttng.1
David Goulet [Fri, 17 May 2013 15:29:34 +0000 (11:29 -0400)] 
Fix: update tracer version in lttng-sessiond.8 and lttng.1

Fixes #535

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: use memset instead of poll reset for poll init
David Goulet [Thu, 16 May 2013 19:02:15 +0000 (15:02 -0400)] 
Fix: use memset instead of poll reset for poll init

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoUpdate README
David Goulet [Thu, 16 May 2013 15:44:24 +0000 (11:44 -0400)] 
Update README

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: epoll attributes used outside of compat layer
David Goulet [Thu, 16 May 2013 15:30:15 +0000 (11:30 -0400)] 
Fix: epoll attributes used outside of compat layer

This was breaking the poll() support. A lttng_poll_init is added which
basically resets the lttng poll event data structure and in the case of
epoll sets the epfd to -1.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Remove temporary trace directory on bail-out
Jérémie Galarneau [Wed, 15 May 2013 19:21:13 +0000 (15:21 -0400)] 
Tests: Remove temporary trace directory on bail-out

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Fix the number of tests in test_tracefile_count
Christian Babeux [Wed, 15 May 2013 18:04:10 +0000 (14:04 -0400)] 
Tests: Fix the number of tests in test_tracefile_count

The number of planned tests is dependent on the number of streams (1 per
cpu).

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Add the tracefile size test
Christian Babeux [Tue, 14 May 2013 21:53:47 +0000 (17:53 -0400)] 
Tests: Add the tracefile size test

This test validate the newly introduced tracefile count feature.  In
order to so, we enable a channel with the appropriate file size limits.

After running an instrumented application, we validate that each file in
the trace folder is no larger than the limit set on the command line and
also that some events are present (it's possible that the tracer discard
events, so we can't validate on a fixed number of events in the
resulting trace).

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Add the tracefile count test
Christian Babeux [Tue, 14 May 2013 21:53:46 +0000 (17:53 -0400)] 
Tests: Add the tracefile count test

This test validate the newly introduced tracefile count feature.  In
order to so, we enable a channel with the appropriate limits in
overwrite mode. The later constraint is to ensure that at least the last
few events are properly recorded and that we can validate that they are
present in the resulting trace (with the help of babeltrace and
babelstats).

We also validate that the tracefile count (per stream) in the trace
folder is conform to the one passed on the command line.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Move the babelstats utility to tests/utils
Christian Babeux [Tue, 14 May 2013 21:53:45 +0000 (17:53 -0400)] 
Tests: Move the babelstats utility to tests/utils

This utility will prove useful in trace validation for other tests, so
put it in a common location accessible by the tests.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Read from pointer after free in unit tests
David Goulet [Tue, 14 May 2013 17:22:27 +0000 (13:22 -0400)] 
Fix: Read from pointer after free in unit tests

Issue 1019886 and 1019887 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Read from pointer after free
David Goulet [Tue, 14 May 2013 17:13:53 +0000 (13:13 -0400)] 
Fix: Read from pointer after free

Also, a fd leak is fixed in an error path in the same thread.

Issue 1019889 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Uninitialized scalar variable in consumer
David Goulet [Tue, 14 May 2013 16:54:46 +0000 (12:54 -0400)] 
Fix: Uninitialized scalar variable in consumer

In notify_channel_pipe: Use of an uninitialized variable (CWE-457).

Issue 1019894 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Uninitialized pointer read
David Goulet [Tue, 14 May 2013 16:52:32 +0000 (12:52 -0400)] 
Fix: Uninitialized pointer read

The lttng poll clean call is slightly changed to handle negative epoll
fd so we don't close anything blindly creating perror() outputs for
nothing.

Issue 1019895 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: fd leak in process client msg error path
David Goulet [Tue, 14 May 2013 16:41:49 +0000 (12:41 -0400)] 
Fix: fd leak in process client msg error path

The process_client_msg() function could return an error but no
sock_error. In any case, we have to close the socket since a TODO is
still there indicating that we need to reply to the client to inform of
the error.

Issue 1019920 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: memory leak in UST unit test
David Goulet [Tue, 14 May 2013 16:38:10 +0000 (12:38 -0400)] 
Fix: memory leak in UST unit test

Issue 1019913 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: memory leak in URI unit test
David Goulet [Tue, 14 May 2013 16:35:25 +0000 (12:35 -0400)] 
Fix: memory leak in URI unit test

Issue 1019914 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: close fd on create unix sock error path
David Goulet [Tue, 14 May 2013 16:33:15 +0000 (12:33 -0400)] 
Fix: close fd on create unix sock error path

Issue 1019915 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: memory leak in error path in UST registry
David Goulet [Tue, 14 May 2013 16:25:26 +0000 (12:25 -0400)] 
Fix: memory leak in error path in UST registry

Issue 1019919 and 1019918 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: memory leak in sessiond command in error path
David Goulet [Tue, 14 May 2013 16:14:35 +0000 (12:14 -0400)] 
Fix: memory leak in sessiond command in error path

Issue 1019921 of coverity scan.

More leaks were found of the same type also.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: kernel metadata data leak in error path
David Goulet [Tue, 14 May 2013 16:11:03 +0000 (12:11 -0400)] 
Fix: kernel metadata data leak in error path

Issue 1019922 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: data leak in error path of cmd_register_consumer()
David Goulet [Tue, 14 May 2013 16:07:00 +0000 (12:07 -0400)] 
Fix: data leak in error path of cmd_register_consumer()

Issue 1019923 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: out of bounds access of kernel channel padding
David Goulet [Tue, 14 May 2013 15:59:23 +0000 (11:59 -0400)] 
Fix: out of bounds access of kernel channel padding

The padding of the old ABI is bigger than the new one so we use the size
of the new padding size for the memcpy since it will always be smaller.

In kernctl_create_channel: Out-of-bounds access to a buffer (CWE-119).
In kernctl_open_metadata: Out-of-bounds access to a buffer (CWE-119).

Issue 1019925 and 1019924 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: out of bounds access to buffer uuid
David Goulet [Tue, 14 May 2013 15:42:06 +0000 (11:42 -0400)] 
Fix: out of bounds access to buffer uuid

In ask_channel_creation: Out-of-bounds access to a buffer (CWE-119)

Issue 1019926 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: possible out of bounds write in enable-event
David Goulet [Tue, 14 May 2013 15:34:51 +0000 (11:34 -0400)] 
Fix: possible out of bounds write in enable-event

In loglevel_str_to_value: Out-of-bounds write to a buffer (CWE-119).

Issue 1019927 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Replace usage of gen-ust-events testapp in ust metadata-flush test
Christian Babeux [Mon, 13 May 2013 22:30:56 +0000 (18:30 -0400)] 
Tests: Replace usage of gen-ust-events testapp in ust metadata-flush test

Use the gen-ust-events binary found under
tests/utils/testapp/gen-ust-events/.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Replace usage of gen-ust-events testapp in ust nprocesses test
Christian Babeux [Mon, 13 May 2013 22:30:55 +0000 (18:30 -0400)] 
Tests: Replace usage of gen-ust-events testapp in ust nprocesses test

Use the gen-ust-events binary found under
tests/utils/testapp/gen-ust-events/.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Replace usage of gen-ust-events testapp in ust buffers-uid test
Christian Babeux [Mon, 13 May 2013 22:30:54 +0000 (18:30 -0400)] 
Tests: Replace usage of gen-ust-events testapp in ust buffers-uid test

Use the gen-ust-events binary found under
tests/utils/testapp/gen-ust-events/.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Replace usage of gen-ust-events testapp in ust before-after test
Christian Babeux [Mon, 13 May 2013 22:30:53 +0000 (18:30 -0400)] 
Tests: Replace usage of gen-ust-events testapp in ust before-after test

Use the gen-ust-events binary found under
tests/utils/testapp/gen-ust-events/.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Replace usage of gen-ust-events testapp in streaming tests
Christian Babeux [Mon, 13 May 2013 22:30:52 +0000 (18:30 -0400)] 
Tests: Replace usage of gen-ust-events testapp in streaming tests

Use the gen-ust-events binary found under
tests/utils/testapp/gen-ust-events/.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Cleanup and move gen-ust-events testapp under utils
Christian Babeux [Mon, 13 May 2013 22:30:51 +0000 (18:30 -0400)] 
Tests: Cleanup and move gen-ust-events testapp under utils

This will improve the maintainability and stop the copying madness going
on in each test needing a UST sample application.

Application under test should go in tests/utils/testapp/<testapp_name>/.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
This page took 0.042641 seconds and 4 git commands to generate.