Michael Jeanson [Wed, 10 May 2017 21:01:36 +0000 (17:01 -0400)]
Cleanup: uuid library detection
Simplify libuuid detection code and use a variable to store the detected
lib instead of adding conditionnal code to each Makefile.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 2 May 2017 17:18:33 +0000 (13:18 -0400)]
Fix: Don't override user variables within the build system
Instead use the appropriatly prefixed AM_* variables as to not interfere
when a user variable is passed to a make command. The proper use of flag
variables is documented at :
https://www.gnu.org/software/automake/manual/automake.html#Flag-Variables-Ordering
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Mon, 6 Feb 2017 20:28:52 +0000 (15:28 -0500)]
Fix: registry can be null on lookup
A session teardown can be initiated by a dying application. Hence, a
session object can exist without a valid registry. As a result,
get_session_registry can return null. To prevent this, the UST
application session lock should be held, when possible, when looking up
the registry to ensure synchronization. Otherwise the presence of a
registry is not guaranteed. In such case, handling a null return value
from look-up registry function is necessary.
Core dumps, triggered by the "assert(registry)" statement found in
reply_ust_register_channel, were observed when killing instrumented
applications. In this occurrence, obtaining the UST application lock
result in a deadlock since the lock is already held during
ust_app_global_create. Handling the null value is simpler and
corresponds with the handling of previous look-up done during the
function.
Handling of null value is also applied to:
add_event_ust_registry
add_enum_ust_registry
ust_app_snapshot_record
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Wed, 31 May 2017 21:08:23 +0000 (17:08 -0400)]
Test: Replace test relying on pselect6(2) man page ambiguity
The `pselect_fd_too_big` test is checking for the case where the `nfds`
is larger than the number of open files allowed for this process
(RLIMIT_NOFILE).
According to the ERRORS section of the pselect6(2) kernel man page[1], if
`nfds` > RLIMIT_NOFILE is evaluate to true the pselect6 syscall should
return EINVAL but the BUGS section mentions that the current
implementation ignores any FD larger than the highest numbered FD of the
current process.
This is in fact what happens. The Linux implementation of the pselect6
syscall[2] does not compare the `nfds` and RLIMIT_NOFILE, but rather caps
`nfds` to the highest numbered FD of the current process as the BUGS
kernel man page mentionned.
It was observed elsewhere that there is a discrepancy between the manual
page and the implementation[3].
As a solution, replace the current testcase with one that checks the
behaviour of the syscall when an invalid FD is passed.
[1]:http://man7.org/linux/man-pages/man2/pselect6.2.html
[2]:https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/select.c#n619
[3]:https://patchwork.kernel.org/patch/
9345805/
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 1 Jun 2017 19:26:47 +0000 (15:26 -0400)]
Tests: channel subbuffers must be larger or equal to PAGE_SIZE
The multi-app notification test creates channel with 4096 byte
subbuffers. However, this is not supported on architectures
with larger pages, such as PPC64el.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Wed, 31 May 2017 17:25:29 +0000 (13:25 -0400)]
Tests: regression testing for notification API
This test suite includes tests for low and high buffer usage conditions,
triggers, and multi application client scenarios.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 25 May 2017 09:15:52 +0000 (05:15 -0400)]
Tests: add consumer testpoint to pause data consumption
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sun, 28 May 2017 17:35:40 +0000 (13:35 -0400)]
Fix: explicitly send client credentials during handshake
The notification client does not send its credentials during
the handshake. However, the session daemon will still receive
them except in very rare, and hard to reproduce, cases.
It appears that the kernel will provide the credential cmsg
regardless of whether or not the client has actually sent them.
Inspecting the kernel source (af_unix.c) seems to indicate that
the credentials will be passed on sendmsg whenever one of the
sockets involved has set the SO_PASSCRED flag. It also seems to
maintain compatibility with applications that expect write() to
pass credentials by default. This explains why the explicit
passing didn't seem needed.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 20 Apr 2017 21:19:35 +0000 (17:19 -0400)]
Test: utils: introduce LTTNG_SESSIOND_ENV_VARS
When LTTNG_SESSIOND_ENV_VARS is set when calling start_lttng_sessiond_*
the value from LTTNG_SESSIOND_ENV_VARS will be passer to the "env"
command while launching the sessiond.
Allow the use of LD_PRELOAD, LTTNG_ENABLE_TESTPOINT and others.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 20 Apr 2017 21:16:20 +0000 (17:16 -0400)]
Test: utils.sh: use getconf to start either 32 or 64 consumerd
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 15:54:30 +0000 (11:54 -0400)]
Optimization: remove unnecessary buffer resizes on partial recvs
Using the dynamic buffer's size to express the current offset
results in unnecessary resized and re-zeroing of areas of the
buffer.
The reception buffer's size is now used to express the total
size of the expected incoming message. The offset can be inferred
from the "bytes_left_to_receive" variable and message size. It
also, arguably, makes the code simpler to follow.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 11:32:50 +0000 (07:32 -0400)]
Docs: improve the documentation of the dynamic buffer interface
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 11:18:35 +0000 (07:18 -0400)]
Add comment to round_to_power_of_2()
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 10:59:18 +0000 (06:59 -0400)]
Clean-up: simplify the implementation of dynamic buffer set_capacity
Only use realloc() to implement set_capacity's logic. In the case
where buf is NULL, realloc acts like malloc() anyhow.
Moreover, the memory does not need to be zeroed on allocation since
size increases provide this guarantee.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 10:26:27 +0000 (06:26 -0400)]
Fix: space left in buffer may be uninitilized on capacity increase
In the following case of dynamic buffer resize:
|---------|---------------------|------------------------|
^ ^ ^
(a) original_size (b) original_capacity (c) new_capacity
The code (correctly) assumes that the space between b and c is
zero-initialized. However, the space between a and b will be left
uninitialized.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 10:20:04 +0000 (06:20 -0400)]
Assert that dynamic buffer size <= capacity
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 10:19:30 +0000 (06:19 -0400)]
Clean-up: improve readability of dynamic buffer append condition
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 10:17:48 +0000 (06:17 -0400)]
Fix: inbound buffer may be set too short on partial command reception
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 10:14:39 +0000 (06:14 -0400)]
Clean-up: fix misleading code alignment
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 10:14:23 +0000 (06:14 -0400)]
Clean-up: remove useless comment
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 25 May 2017 09:17:14 +0000 (05:17 -0400)]
Fix: return LTTNG_ERR_INVALID_TRIGGER on validation failure
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 25 May 2017 09:16:38 +0000 (05:16 -0400)]
Fix: missing includes in buffer-usage.h
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 24 Mar 2017 15:30:34 +0000 (11:30 -0400)]
Unit tests for notification api
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 24 Mar 2017 15:29:34 +0000 (11:29 -0400)]
Run unit tests before regression tests
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 23 May 2017 14:15:59 +0000 (10:15 -0400)]
Fix: semaphore semantics are expected from notification command eventfd
The notification command queue currently expects eventfd() to
behave according to EFD_SEMAPHORE semantics. Right now, multiple
commands could be enqueued and reading the eventfd resets its
internal counter to 0. This will cause the notification thread
to never process the next command.
EFD_SEMAPHORE will ensure that poll/epoll signals that there is
info available for reading until the eventfd's internal counter
returns to 0.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 17 Sep 2015 16:24:32 +0000 (12:24 -0400)]
relay: use urcu_ref_get_unless_zero
This allows removing the reflock be performing this check and increment
atomically.
The minimum version of userspace-rcu is bumped to 0.9.0 as
urcu_ref_get_unless_zero() was introduced as part of that
release.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 11 May 2017 21:53:58 +0000 (17:53 -0400)]
Fix: use "flush empty" ioctl for snapshots
When the flush empty ioctl is available, use it to produce an empty
packet at the end of the snapshot, which ensures the stream intersection
feature works.
If this specific ioctl is not available, fallback on the "flush" ioctl,
which does not produce empty packets.
In that situation, there were two prior behaviors possible for
lttng-modules: earlier versions implement a "snapshot" command which
does not perform an implicit "flush_empty". In that case, the stream
intersection feature may not be reliable. In more recent lttng-modules
versions (included stable branch) which did not implement the
flush_empty ioctl, the snapshot ioctl implicitly performed a
flush_empty, which makes the stream intersection feature work, but has
side-effects on the snapshot ioctl performed by the live timer (produces
a stream of empty packets in live mode).
[ Please apply to master, 2.10, 2.9, 2.8 branches. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 11 May 2017 20:00:56 +0000 (16:00 -0400)]
Fix: lttng-consumerd: cpu hotplug: send "streams_sent" command
When creating a new channel, the streams being sent to the relayd are
kept invisible to the live client until the "streams_sent" command is
received. This ensures the client does not see a partial stream set.
This "streams_sent" command needs to be sent on CPU hotplug too,
otherwise the live client handling within relayd is not aware of those
streams (they are never published).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 11 May 2017 20:00:55 +0000 (16:00 -0400)]
Fix: lttng-sessiond: cpu hotplug: send channel to consumer only once
On CPU hotplug, we currently send a duplicate of the channel key, which
allocates its own object (duplicated) within the consumerd. We want the
newly added stream to map to the pre-existing channel key, so don't send
the channel duplicate.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 11 May 2017 20:00:54 +0000 (16:00 -0400)]
Fix: lttng-sessiond: cpu hotplug stream number mismatch
The counter should be always increasing (kept in the channel), rather
than local to the function. This causes cpu hotplug handling to
disregard further streams that should be added to the consumer output
on CPU hotplug.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 19 May 2017 15:19:16 +0000 (11:19 -0400)]
Tests: use SIGKILL to shutdown daemons in test_thread_exit and test_tp_fail
A current design limitation of the lttng-consumerd will cause it to
hang on shutdown if the timer management thread exits as the teardown
of channels switches off the channel's timers. The timer thread is
then expected to purge timer signals and signal when it is done.
Obviously this state will never be reached as signals are no longer
being processed. This is not dramatic as this is not what this test
is meant to test; we only want to make sure the health check signals that
something went wrong.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 18 May 2017 20:15:20 +0000 (16:15 -0400)]
Fix: consumer_timer_signal_thread_qs waits on LTTNG_CONSUMER_SIG_SWITCH
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 18 May 2017 15:40:03 +0000 (11:40 -0400)]
Revert "Fix: futex can be free'd while used by waker thread"
This reverts commit
dce89628fd85a875a8dc511d861057f218f3c1c8.
Mathieu Desnoyers [Wed, 17 May 2017 22:36:54 +0000 (18:36 -0400)]
Fix: thread exit vs futex wait/wakeup race
relayd_live_stop performs, in this order:
CMM_STORE_SHARED(live_dispatch_thread_exit, 1); [A]
futex_nto1_wake(&viewer_conn_queue.futex); [B]
whereas thread_dispatcher does:
while (!CMM_LOAD_SHARED(live_dispatch_thread_exit)) { [1]
[...]
futex_nto1_prepare(&viewer_conn_queue.futex); [2]
[...]
futex_nto1_wait(&viewer_conn_queue.futex); [3]
Unfortunately, on the following sequence:
[1] [A] [B] [2] [3]
thread_dispatcher will end up hanging.
We need to move the live_dispatch_thread_exit load between "prepare" and
"wait" to fix this.
There are similar scenarios with relay_thread_dispatcher, and the
session daemon thread_dispatch_ust_registration, which are also fixed
here.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 17 May 2017 20:03:13 +0000 (16:03 -0400)]
Fix: use lttng_waiter instead of futex in notification thread
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 17 May 2017 15:16:33 +0000 (11:16 -0400)]
Add lttng_waiter utils
This utils is adapted from userspace-rcu's urcu-wait.h
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 15 May 2017 19:14:07 +0000 (15:14 -0400)]
Fix: pthread_join on thread start error
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 15 May 2017 15:16:45 +0000 (11:16 -0400)]
Fix: missing check on notification thread join
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 15 May 2017 14:37:18 +0000 (10:37 -0400)]
Fix: status_loc argument of waitpid() is used on error
waitpid() may leave stat_loc uninitialized on error (depending
on errno's value, see WAIT(3)).
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 11 May 2017 20:16:12 +0000 (16:16 -0400)]
Fix: leak of deserialized trigger sent from client
Deserialized triggers may be leaked on error when
registered or unregistered by the session daemon.
Reported-by: Coverity Scan
CID
1374801 (#1 of 1): Resource leak (RESOURCE_LEAK)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 11 May 2017 20:13:25 +0000 (16:13 -0400)]
Clean-up: missing static qualifier on internal function
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 11 May 2017 14:02:48 +0000 (10:02 -0400)]
Fix: duplicate values used in lttng_evaluation_status enum
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 11 May 2017 14:02:19 +0000 (10:02 -0400)]
Fix: missing header inclusions in buffer-usage.h
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 9 May 2017 19:46:35 +0000 (15:46 -0400)]
Fix: COMPAT_EPOLL_PROC_PATH is available from Linux 2.6.28
v2: Typo in commit message "per see" -> "per se"
Failing on opening [1] is not an error per se. [1] was
introduced in Linux 2.6.28 but epoll is available since
2.5.44. Hence, goto end and set a default value without
setting error return value.
[1] /proc/sys/fs/epoll/max_user_watches
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 10 May 2017 20:42:09 +0000 (16:42 -0400)]
Fix: skip empty revents in notificationthread
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 10 May 2017 19:49:57 +0000 (15:49 -0400)]
Clean-up: warning caused by unused label
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 10 May 2017 19:36:23 +0000 (15:36 -0400)]
Fix: futex can be free'd while used by waker thread
The futex_nto1 utils assume that the futex it operates on
has a program-long lifetime (or that is is protected by a
third-party).
The notification command system uses a futex allocated on the
waiter's stack. However, the waiter could never enter the
futex() syscall (due to of the opportunist check before the futex
call). In this case, the waiter's stack-allocated futex becomes
invalid, but will be used by the waker to perform the FUTEX_WAKE
operation.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 9 May 2017 12:50:39 +0000 (08:50 -0400)]
Fix: missing header causes build failure with --disable-epoll
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 8 May 2017 11:48:52 +0000 (07:48 -0400)]
Fix: return NULL pointer on memory allocation failure
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 9 May 2017 12:20:17 +0000 (08:20 -0400)]
Clean-up: unused variable warning in poll compat
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This page took 0.048643 seconds and 4 git commands to generate.