Benjamin Poirier [Mon, 6 Jan 2020 05:19:54 +0000 (14:19 +0900)]
doc: Fix bind address example for lttng-relayd
INADDR_ANY is 0.0.0.0
Fixes: c93eadade277 ("doc/man: use propagated default values in man pages")
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Benjamin Poirier <benjamin.poirier@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6e908adca66b829128ea31cf392bccad3f96d63d
Michael Jeanson [Thu, 7 Nov 2019 19:02:55 +0000 (14:02 -0500)]
Require automake >= 1.12
The test suite LOG_DRIVER statement requires that automake >= 1.12 be used
during bootstrap.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 1 Nov 2019 20:23:05 +0000 (16:23 -0400)]
Fix: sessiond: ust: deadlock with per-pid buffers
Do not hold the registry lock while communicating with the consumerd,
because doing so causes inter-process deadlocks between consumerd and
sessiond with the metadata request notification.
The deadlock involves both sessiond and consumerd:
* lttng-sessiond:
thread 11 - thread_application_management
close_metadata()
pthread_mutex_lock(®istry->lock);
consumer_close_metadata()
pthread_mutex_lock(socket->lock);
thread 15 - thread_consumer_management
ust_consumer_metadata_request()
pthread_mutex_lock(&ust_reg->lock);
thread 8 - thread_manage_clients
consumer_is_data_pending
pthread_mutex_lock(socket->lock);
consumer_socket_recv()
* lttng-consumerd:
thread 4 - consumer_timer_thread
sample_channel_positions()
pthread_mutex_lock(&stream->lock);
thread 8 - consumer_thread_sessiond_poll
consumer_data_pending
pthread_mutex_lock(&consumer_data.lock);
pthread_mutex_lock(&stream->lock);
thread 7 - consumer_thread_data_poll
lttng_consumer_read_subbuffer
pthread_mutex_lock(&stream->chan->lock);
pthread_mutex_lock(&stream->lock);
do_sync_metadata
pthread_mutex_lock(&metadata->lock);
lttng_ustconsumer_sync_metadata
pthread_mutex_unlock(&metadata_stream->lock);
lttng_ustconsumer_request_metadata()
pthread_mutex_lock(&ctx->metadata_socket_lock);
lttcomm_recv_unix_sock()
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 25 Oct 2019 21:56:26 +0000 (17:56 -0400)]
Fix: lttng: initialize sessions pointer to NULL
lttng_list_sessions does not set the passed pointer to NULL on empty
return. This leads to a deallocation of an invalid pointer (segfault).
For returns of size 0, the value of the passed argument should be
considered "undefined".
Refactor error handling a bit by removing the "error" jump. Always
call free on the 'sessions' object.
Fixes #1205
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, 18 Oct 2019 20:39:00 +0000 (16:39 -0400)]
Fix: sessiond: use system LTTng-UST headers when available
The LTTng-Tools tree includes a local copy of three LTTng-UST headers:
* ust-error.h
* ust-ctl.h
* ust-abi.h
The system headers should be used when UST support is configured to
ensure the appropriate ABI definitions are used. The local copies of
the headers should only be used when LTTng-Tools is built with the
--without-lttng-ust configuration option. Those headers are needed
since some UST support code is compiled-in even though the support
is deactivated.
A misconfiguration in the CI setup allowed us to notice that
sessiond-config.c is using the internal header unconditionally.
To ensure this doesn't happen in the future, the local copies
are renamed:
* ust-error.h -> ust-error-internal.h
* ust-ctl.h -> ust-ctl-internal.h
* ust-abi.h -> ust-abi-internal.h
All code should use the `lttng-` prefixed versions of the headers
which include either the local or "system" copy of the headers
depending on the build configuration.
Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 18 Oct 2019 19:53:05 +0000 (15:53 -0400)]
doc/man: use specific revision date for each manual page
This patch makes each manual page indicate its own revision date with
the `revdate` AsciiDoc attribute.
In `asciidoc.conf`, we use this attribute to specify the DocBook
reference page date (see
<https://tdg.docbook.org/tdg/4.5/refentryinfo.html> and
<https://tdg.docbook.org/tdg/4.5/date.html>).
Without the DocBook date tag, `xmlto` uses the current date. You can
see this date at the bottom of the rendered manual page:
...
SEE ALSO
lttng-enable-rotation(1), lttng-disable-rotation(1), lttng(1)
LTTng 2.12.0-pre 10/18/2019 LTTNG-ROTATE(1)
Using the manual page generation date seems unexpected for the reader
here.
For this initial change, I used the last commit date for each source
file.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 17 Oct 2019 19:37:04 +0000 (15:37 -0400)]
Update version to v2.10.9
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 8 Oct 2019 18:18:31 +0000 (14:18 -0400)]
Fix: sessiond: TOCTOU error on save of session configuration
The session_save() function checks for the existance and access rights
on the target session configuration filename before opening it. This
results in a TOCTOU (Time of check, time of use) problem.
Defer the check and error reporting to the run_as_open() call.
1191754 Time of check time of use
An attacker could change the filename's file association or other
attributes between the check and use. In save_session: A check occurs
on a file's attributes before the file is used in a privileged
operation, but things may have changed (CWE-367)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 8 Oct 2019 18:01:54 +0000 (14:01 -0400)]
Fix: tests: replace truncation-prone logging helper
The printerr() error logging scheme in test_utils_expand_path
is prone to unexpected truncations which results in a lot of
warnings when building using GCC 9.2.
It is replaced by a variable-argument macro that uses fprintf()
directly.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 1 Oct 2019 20:39:56 +0000 (16:39 -0400)]
Update version to v2.10.8
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 19 Sep 2019 18:24:34 +0000 (14:24 -0400)]
Fix: lttng: out-of-bound copy of arguments in 'view' command handler
The 'size' operand of memcpy() does not indicate the length of the
opts array; it is the size of the resulting array once the opts array
is concatenated with the options being added in this function. This
results in out-of-bound read(s) in the opts array.
Use 'sizeof(char *) * opts_len' as the length to copy at the beginning
of the resulting array.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sun, 15 Sep 2019 18:27:40 +0000 (14:27 -0400)]
sessiond: fix: strncpy called with source length
strncpy is called with the source's length in two cases in the
session save code. Use the destination and remaining destination
length as intended by the API.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 14 Sep 2019 20:02:33 +0000 (16:02 -0400)]
sessiond: fix: possible unaligned access in packed structure
'&rsock->sock.fd' is passed to consumer_send_fds and may result in an
unaligned pointer value. Use the ALIGNED_CONST_PTR macro to create
an aligned copy of the fd that is being passed.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 14 Sep 2019 19:51:32 +0000 (15:51 -0400)]
lttng-ctl: fix: possible unaligned access in packed structure
Wrap all lttng_domain copies with COPY_DOMAIN_PACKED which copies the
source domain to a temporary destination (on stack) and then assign
this temporary domain to the destination domain. This ensures the
compiler generates the code needed to perform the unaligned accesses
to the domain.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 14 Sep 2019 18:25:25 +0000 (14:25 -0400)]
consumer: fix: possible unaligned access in packed structure
Fix the warnings that unaligned pointers can be passed as parameters
emitted when sampling buffer statistics.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 12 Sep 2019 15:51:52 +0000 (11:51 -0400)]
inet: fix: possible unaligned access in packed structure (inet/inet6)
Fix the warnings that unaligned pointers can be passed as parameters
emitted when building inet.c and inet6.c.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 13 Sep 2019 20:48:18 +0000 (16:48 -0400)]
consumer: fix: unaligned accesses to index fields
The ctf_index structure, being part of the ABI, is explicitly packed
using the LTTNG_PACKED macro. However, populating it by using pointers
to its members is not acceptable as it may cause the ust and kernel
tracer APIs to populate write their return values using unaligned
pointers.
Use automatic storage variables to fetch the various index fields and
populate the index at-once using a compound literal.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 12 Sep 2019 14:17:41 +0000 (10:17 -0400)]
lttng: fix: potential 0-length allocation in pid list parsing
Check that count is > 0 before allocating pid list. This would
only happen after a prior error, but check it anyway.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 12 Sep 2019 14:12:41 +0000 (10:12 -0400)]
Tests: fix: uninitialized session_id used on list_sessions failure
Stop live test when list_sessions() fails since the session_id used
further on would be uninitialized.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 12 Sep 2019 14:08:44 +0000 (10:08 -0400)]
Tests: fix: uninitialized values passed to close() on error
The fds array is not initialized resulting in uninitialized file
descriptors being passed to close() when an error is encountered in
the epoll-setting loop.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 11 Sep 2019 16:18:15 +0000 (12:18 -0400)]
lttng-ctl: fix: lttng_data_pending confuses communication status
lttng_ctl_ask_sessiond can return a positive value even though it
failed to receive the variable length payload of a session message
reply. In this case, lttng_ctl_ask_sessiond ends up calling into
lttng_ctl_ask_sessiond_fds_varlen() which will return the (negated)
error code returned by the session daemon if it was not LTTNG_OK.
The peer could return anything here, which lttng_data_pending will end
up interpreting as the length of the variable data that was received.
In this case, if the sessiond returns '-1', '1' will be returned to
lttng_data_pending, which it will interpret as being the length of the
'data_pending' byte flag. It will then dereference 'pending', which is
NULL, and (most likely) crash.
Check for NULL on top of checking for the return code. This
communication layer needs love as much as it needs a bulldozer.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Geneviève Bastien [Fri, 13 Apr 2018 19:51:28 +0000 (15:51 -0400)]
Fix typo in regenerate statedump test util
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 10 Jun 2019 17:31:31 +0000 (13:31 -0400)]
Fix: metadata stream is not marked as quiescent after packet commit
When a metadata stream's wait fd is hung-up or enters an error state,
it is checked for quiescence in lttng_ustconsumer_on_stream_hangup().
If the stream is not quiescent, the current packet is closed through
the flush_buffer operation.
Currently, all commits to metadata streams are done on a packet
basis. The various code paths using the commit_one_metadata_packet
helper all perform a flush directly after the commit. Performing this
flush leaves the stream in a "quiescent" state, but does not mark it
as such.
This results in an extraneous flush being performed in the err/hup
handler, which leaves an empty packet to be consumed. This packet is
then consumed during the execution of the err/hup handler.
This bug results in an empty packet being appended to metadata
streams. This packet is typically ignored by readers, but the fact
that it is written at the time of the destruction of a session
violates the immutability guarantee of the session stop
command. Moreover, following the introduction of trace chunks, this
results in the stream attempting to serialize the empty buffer to its
output file _after_ its trace chunk has been closed, causing an
assertion to hit.
Hence, this fix performs the buffer flush and sets the stream as
quiescent directly in commit_one_metadata_packet().
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 16 May 2019 16:18:10 +0000 (12:18 -0400)]
Remove unused bitfield.h header
There are no users of the bitfield.h header. It was previously
used to list syscalls from a kernel channel in
834978fd, but
this function was removed in
9897fbc9.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 24 Sep 2019 05:10:58 +0000 (01:10 -0400)]
Fix: sessiond: fs.protected_regular sysctl breaks app registration
I observed that userspace tracing no longer worked when an
instrumented application (linked against liblttng-ust) was launched
before the session daemon.
While investigating this, I noticed that the shm_open() of
'/lttng-ust-wait-8' failed with EACCES. As the permissions on the
'/dev/shm' directory and the file itself should have allowed the
session daemon to open the shm, this pointed to a change in kernel
behaviour.
Moreover, it appeared that this could only be reproduced on my
system (running Arch Linux) and not on other systems.
It turns out that Linux 4.19 introduces a new protected_regular sysctl
to allow the mitigation of a class of TOCTOU security issues related
to the creation of files and FIFOs in sticky directories.
When this sysctl is not set to '0', it specifically blocks the way the
session daemon attempts to open the app notification shm that an
application has already created.
To quote a comment added in linux's fs/namei.c as part of
30aba6656f:
```
Block an O_CREAT open of a FIFO (or a regular file) when:
- sysctl_protected_fifos (or sysctl_protected_regular) is enabled
- the file already exists
- we are in a sticky directory
- we don't own the file
- the owner of the directory doesn't own the file
- the directory is world writable
```
While the concerns that led to the inclusion of this patch are valid,
the risks that are being mitigated do not apply to the session
daemon's and instrumented application's use of this shm. This shm is
only used to wake-up applications and get them to attempt to connect
to the session daemon's application socket. The application socket is
the part that is security sensitive. At worst, an attacker controlling
this shm could wake up the UST thread in applications which would then
attempt to connect to the session daemon.
Unfortunately (for us, at least), systemd v241+ sets the
protected_regular sysctl to 1 by default (see systemd commit
27325875), causing the open of the shm by the session daemon to fail.
Introduce a fall-back to attempt a shm_open without the O_CREAT flag
when opening it with 'O_RDWR | O_CREAT' fails. The comments detail the
reason why those attempts are made in that specific order.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 23 Sep 2019 18:31:33 +0000 (14:31 -0400)]
Fix: lttng-crash: detect truncated files
Detect truncated files which size is smaller than the ring buffer
header.
This can be caused by a situation where sessiond is killed with SIGKILL
while doing a metadata regenerate command.
Without this fix, lttng-crash is killed with a "Bus error" when
encountering a truncated file.
Fixes: #1166
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 24 Sep 2019 15:24:17 +0000 (11:24 -0400)]
Fix: use newly created event filter for condition check
The following commit introduced a regression while
fixing the filter and filter_expression ownership.
commit
b0a23296344e57bd2e48e62ec2d7e0d8a38661bb
Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Date: Sat Jan 12 14:53:56 2019 -0500
Fix: leak of filter bytecode and expression on agent event re-enable
The agent subsystem does not properly assume the clean-up of an
event's filter bytecode and expression when a previously disabled
event is re-enabled.
This change ensures that the ownership of both the filter bytecode
and expression is assumed by the agent subsystem and discarded
when a matching event is found.
Steps to reproduce the leak:
$ lttng create
$ lttng enable-event --python allo --filter 'a[42] == 241'
$ lttng disable-event --python allo
$ lttng enable-event --python allo --filter 'a[42] == 241'
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Setting the "filter" object to NULL prevents the call to
add_filter_app_ctx when needed.
We use the filter from the newly created event to
perform the check and the call to add_filter_app_ctx.
Fixes coverity #
1399733
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 3 Jun 2019 19:25:52 +0000 (15:25 -0400)]
Fix: namespace our gettid wrapper
Since glibc 2.30, a gettid wrapper was added that conflicts with our
static declaration. Namespace our wrapper so there is no conflict,
we'll add support for the glibc provided wrapper in a further commit.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Wed, 22 May 2019 20:49:01 +0000 (16:49 -0400)]
Fix: check for lttng modules presence before testing
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 9 Aug 2019 21:01:35 +0000 (17:01 -0400)]
Fix: test_crash: don't kill first app twice
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:08:00 +0000 (15:08 -0400)]
Cleanup: test: don't stop relayd twice
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:07:59 +0000 (15:07 -0400)]
Fix: test: utils.sh: exit from process on full_cleanup
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:07:58 +0000 (15:07 -0400)]
Fix: utils.sh: handle SIGPIPE
perl prove closes its child pipes before giving it a chance to execute
the signal trap handler. This means the child will not be able to
complete execution of the trap handler if that handler writes to stdout
or stderr.
Work-around this situation by redirecting stdin, stdout, and stderr
to /dev/null if a SIGPIPE is caught.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:07:57 +0000 (15:07 -0400)]
Fix: tests: error handling in high throughput limits test (v2)
Each individual call to "tc" should be checked for error, else we
may fail to catch specific tc errors caused, for instance, by a
kernel configuration that only contains some of the required
class modules.
Also, invoke the utils.sh full_cleanup function from the script-specific
interrupt_cleanup trap handler rather than try to perform stopping
of relayd and sessiond within the script.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:07:56 +0000 (15:07 -0400)]
Improve handling of test SIGTERM/SIGINT (v2)
The current state of signal handling for test scripts is: on
SIGTERM/SIGINT of the tests (e.g. a CTRL-C on the console), session
daemon and relay daemon are killed with SIGKILL, thus leaking all their
resources, and leaving lttng kernel modules loaded.
Revamp the "stop" functions to take a signal number and a timeout
as optional parameters. The default signal number is SIGTERM.
The full_cleanup trap handler now tries to nicely kill relayd and
sessiond (if they are present) with SIGTERM, and wait up to the
user-configurable LTTNG_TEST_TEARDOWN_TIMEOUT environment variable
(which has a default of 60s). Then, if there are still either relayd,
sessiond, or consumerd present, it will SIGKILL them and wait for
them to vanish. If it had to kill sessiond with SIGKILL, it will
also explicitly try to unload the lttng modules with modprobe.
This approach is inspired from sysv init script shutdown behavior.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Wed, 28 Aug 2019 20:36:03 +0000 (16:36 -0400)]
Fix: check validity of a stream before invoking ust flush command
At the time ustctl_flush_buffer is called the ustream object might have
already been freed on lttng-ust side.
This can happen following a lttng_consumer_cleanup_relayd and concurrent
consumer flush command (lttng stop).
The chain of events goes as follows.
An error on communication with lttng-relayd occurs.
lttng_consumer_cleanup_relayd flags the streams for deletion
(CONSUMER_ENDPOINT_INACTIVE). validate_endpoint_status_data_stream calls
consumer_del_stream.
At the same time the hash table of streams is iterated over in the
flush_channel function following a stop command. The loop is iterating on
a given stream. The current thread is unscheduled before taking the stream
lock.
In the initial thread, the same stream is the current iteration of
cds_lfht_for_each_entry in validate_endpoint_status_data_stream.
consumer_del_stream is called on it. The stream lock is acquired, and
destroy_close_stream is called. lttng_ustconsumer_del_stream is eventually
called and at this point the ustream is freed.
Going back to the iteration in flush_channel. The current stream is still
valid from the point of view of the iteration, ustctl_flush_buffer is then
called on a freed ustream object.
This can lead to unknown behaviour since there is no validation on the
lttng-ust side. The underlying memory of the ustream object is garbage at
this point.
To prevent such scenario, we check for the presence of the node in the
hash table via cds_lfht_is_node_deleted while holding the stream lock.
This is valid because the stream destruction removes the node from
the hash table and frees the ustream object with the stream lock held.
This duplicate similar "validation" check of the stream object. [1][2]
[1] src/common/consumer/consumer.c:consumer_close_channel_streams
[2] src/common/ust-consumer/ust-consumer.c:close_metadata
This issue can be reproduced by the following scenario:
Modify flush_channel to sleep (i.e 10s) before acquiring the lock on
a stream.
Modify lttng-ust ustctl_destroy_stream to set the
ring_buffer_clock_read callback to NULL.
Note: An assert on !cds_lfht_is_node_deleted in flush channel
after acquiring the lock can provide the same information. We are
modifying the callback to simulate the original backtrace from our
customer.
lttng-relayd
lttng-sessiond
lttng create --live
lttng enable-event -u -a
lttng start
Start some applications to generate data.
lttng stop
The stop command force a flush of the channel/streams.
pkill -9 lttng-relayd
Expect assert or segfault
The original customer backtrace:
0 lib_ring_buffer_try_switch_slow (handle=<optimized out>, tsc=<synthetic pointer>, offsets=0x3fffa9b76c80, chan=0x3fff98006e90, buf=<optimized out>,
mode=<optimized out>) at /usr/src/debug/lttng-ust/2.9.1/git/libringbuffer/ring_buffer_frontend.c:1834
1 lib_ring_buffer_switch_slow (buf=0x3fff98016b40, mode=<optimized out>, handle=0x3fff98017670)
at /usr/src/debug/lttng-ust/2.9.1/git/libringbuffer/ring_buffer_frontend.c:1952
2 0x00003fffac680940 in ustctl_flush_buffer (stream=<optimized out>, producer_active=<optimized out>)
at /usr/src/debug/lttng-ust/2.9.1/git/liblttng-ust-ctl/ustctl.c:1568
3 0x0000000010031bc8 in flush_channel (chan_key=<optimized out>) at ust-consumer.c:772
4 lttng_ustconsumer_recv_cmd (ctx=<optimized out>, sock=<optimized out>, consumer_sockpoll=<optimized out>) at ust-consumer.c:1651
5 0x000000001000de50 in lttng_consumer_recv_cmd (ctx=<optimized out>, sock=<optimized out>, consumer_sockpoll=<optimized out>) at consumer.c:2011
6 0x0000000010014208 in consumer_thread_sessiond_poll (data=0x10079430) at consumer.c:3192
7 0x00003fffac608b30 in start_thread (arg=0x3fffa9b7bdb0) at pthread_create.c:462
8 0x00003fffac530d0c in .__clone () at ../sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S:96
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 23 May 2019 16:56:57 +0000 (12:56 -0400)]
Fix: initialize syscall table when kernel tracer is lazily initialized
How to reproduce:
start lttng-sessiond while lttng-modules are not installed, then install
lttng-modules. Then issue "lttng list --syscall -k". It will show an
empty syscall list because the system call list has not been
initialized.
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, 24 May 2019 19:25:20 +0000 (15:25 -0400)]
Update version to v2.10.7
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 23 May 2019 18:11:35 +0000 (14:11 -0400)]
Update base test for binding
This test is not run for now as it is not part of the test suite.
Use a temporary directory to store trace.
Split in 2 test suite, one for ust and the other for kernel.
Partially fix formatting.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 23 May 2019 18:02:26 +0000 (14:02 -0400)]
Fix: python binding: expose domain buffer type
On enable_channel the domain buffer type is used to create a temporary
channel. This currently fail for kernel channel since the buffer type is
not exposed at the binding level and default to LTTNG_BUFFER_PER_PID.
Channel for the kernel domain can only be created in LTTNG_BUFFER_GLOBAL
mode.
Exposing the buffer type also allow userpsace channel to use the per uid
buffering scheme.
The current bindings are in a rough state. This is to at least get them
to work with kernel domain.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Yannick Lamarre [Thu, 25 Apr 2019 22:23:27 +0000 (18:23 -0400)]
Fix: lttng_poll_mod calls compat_(e)poll_add
lttng_poll_mod should call compat_(e)poll_mod.
Signed-off-by: Yannick Lamarre <ylamarre@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Mon, 1 Apr 2019 20:33:41 +0000 (16:33 -0400)]
Fix: getgrnam is not MT-Safe, use getgrnam_r
Running the test suite under a Yocto musl build resulted in musl
coredump due to double freeing.
We get the following backtraces:
0 a_crash () at ./arch/x86_64/atomic_arch.h:108
1 unmap_chunk (self=<optimized out>) at src/malloc/malloc.c:515
2 free (p=<optimized out>) at src/malloc/malloc.c:526
3 0x00007f46d9dc3849 in __getgrent_a (f=f@entry=0x7f46d9d1f7e0, gr=gr@entry=0x7f46d9e24460 <gr>, line=line@entry=0x7f46d9e26058 <line>, size=size@entry=0x7f46d92db550, mem=mem@entry=0x7f46d9e26050 <mem>, nmem=nmem@entry=0x7f46d92db558, res=0x7f46d92db548) at src/passwd/getgrent_a.c:45
4 0x00007f46d9dc2e6b in __getgr_a (name=0x487242 "tracing", gid=gid@entry=0, gr=gr@entry=0x7f46d9e24460 <gr>, buf=buf@entry=0x7f46d9e26058 <line>, size=size@entry=0x7f46d92db550, mem=mem@entry=0x7f46d9e26050 <mem>, nmem=0x7f46d92db558, res=0x7f46d92db548) at src/passwd/getgr_a.c:30
5 0x00007f46d9dc3733 in getgrnam (name=<optimized out>) at src/passwd/getgrent.c:37
6 0x0000000000460b29 in utils_get_group_id (name=<optimized out>) at ../../../lttng-tools-2.10.6/src/common/utils.c:1241
7 0x000000000044ee69 in thread_manage_health (data=<optimized out>) at ../../../../lttng-tools-2.10.6/src/bin/lttng-sessiond/main.c:4115
8 0x00007f46d9de1541 in start (p=<optimized out>) at src/thread/pthread_create.c:195
9 0x00007f46d9dee661 in __clone () at src/thread/x86_64/clone.s:22
From another run:
0 a_crash () at ./arch/x86_64/atomic_arch.h:108
1 unmap_chunk (self=<optimized out>) at src/malloc/malloc.c:515
2 free (p=<optimized out>) at src/malloc/malloc.c:526
3 0x00007f5abc210849 in __getgrent_a (f=f@entry=0x7f5abc2733e0, gr=gr@entry=0x7f5abc271460 <gr>, line=line@entry=0x7f5abc273058 <line>, size=size@entry=0x7f5abaef5510, mem=mem@entry=0x7f5abc273050 <mem>, nmem=nmem@entry=0x7f5abaef5518, res=0x7f5abaef5508) at src/passwd/getgrent_a.c:45
4 0x00007f5abc20fe6b in __getgr_a (name=0x487242 "tracing", gid=gid@entry=0, gr=gr@entry=0x7f5abc271460 <gr>, buf=buf@entry=0x7f5abc273058 <line>, size=size@entry=0x7f5abaef5510, mem=mem@entry=0x7f5abc273050 <mem>, nmem=0x7f5abaef5518, res=0x7f5abaef5508) at src/passwd/getgr_a.c:30
5 0x00007f5abc210733 in getgrnam (name=<optimized out>) at src/passwd/getgrent.c:37
6 0x0000000000460b29 in utils_get_group_id (name=<optimized out>) at ../../../lttng-tools-2.10.6/src/common/utils.c:1241
7 0x000000000042dee4 in notification_channel_socket_create () at ../../../../lttng-tools-2.10.6/src/bin/lttng-sessiond/notification-thread.c:238
8 init_thread_state (state=0x7f5abaef5560, handle=0x7f5abbf9be40) at ../../../../lttng-tools-2.10.6/src/bin/lttng-sessiond/notification-thread.c:375
9 thread_notification (data=0x7f5abbf9be40) at ../../../../lttng-tools-2.10.6/src/bin/lttng-sessiond/notification-thread.c:495
10 0x00007f5abc22e541 in start (p=<optimized out>) at src/thread/pthread_create.c:195
11 0x00007f5abc23b661 in __clone () at src/thread/x86_64/clone.s:22
The problem was easily reproducible (~6 crash on ~300 runs). A prototype fix
using mutex around the getgrnam yielded no crash in over 1000 runs. This
patch yielded the same results as the prototype fix.
Unfortunately we cannot rely on a mutex in liblttng-ctl since we cannot
enforce the locking for the application using the lib.
Use getgrnam_r instead.
The previous implementation of utils_get_group_id returned the gid of
the root group (0) on error/not found. lttng_check_tracing_group needs
to know if an error/not found occured, returning the root group is not
enough. We now return the gid via the passed parameter. The caller is
responsible for either defaulting to the root group or propagating the
error.
We also do not want to warn when used in liblttng-ctl context. We might
want to move the warning elsewhere in the future. For now, pass a bool
if we need to warn or not.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 2 Apr 2019 17:41:17 +0000 (13:41 -0400)]
Fix: logging: log_add_time() save/restore errno
The debugging logging macros (e.g. DBG()) are used as printf in the
lttng-tools source files. The printf() implementation does not alter the
errno value, so the fact that log_add_time() (through clock_gettime())
can alter errno is unexpected. For instance, adding a logging statement
for debugging purposes within a function for which errno is expected to
stay unchanged on return will change the behavior between execution with
-vvv and non-verbose.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 24 Apr 2019 22:56:05 +0000 (18:56 -0400)]
Fix relayd: initialize beacon to -1ULL
The relayd stream beacon_ts_end field is expected to have the value
-1ULL when unset (no beacon has been received since last index).
However, the initial state is wrong. It is left at the value 0, which
indicates that a live beacon has indeed been received (which is untrue),
which in turn causes a live beacon with ctf_stream_id of -1ULL to be
sent to babeltrace, which does not expect it, and fails.
This issue can be triggered with the following scenario:
1) create live session
2) setup UST per-uid buffers tracing
3) start tracing, without any active traced application
4) hook with babeltrace live client to view the trace
5) run a traced application
Step 5) will cause the babeltrace live client to receive a stream_id of
-1ULL, and error out.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 3 Apr 2019 20:26:45 +0000 (16:26 -0400)]
Fix: relayd: handling of lttng_read errors >= 0
errno is only set when lttng_read returns a negative value. Else, we
need to print a ERR() statement rather than use PERROR().
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, 10 Apr 2019 20:37:42 +0000 (16:37 -0400)]
Fix tests: NULL pointer dereference in ust channel unit tests
The test_create_ust_channel() test case erroneously checks for
a NULL session instead of a channel. This can result in a
NULL pointer dereference on failure to create a ust channel.
The scope of usess is reduced to prevent similar mistakes in the
future. Moving 'dom' has made it obvious that this variable is
unused. Hence, it is removed.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 10 Apr 2019 20:25:20 +0000 (16:25 -0400)]
Fix tests: NULL pointer dereference in ltt_ust_context unit tests
The check for the expected context's type must be skipped when
trace_ust_create_context() fails. Otherwise, a NULL pointer
dereference will occur.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 10 Apr 2019 19:28:15 +0000 (15:28 -0400)]
Log the wait-shm's path on shm_open failure
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Wed, 28 Mar 2018 19:21:26 +0000 (15:21 -0400)]
Tests: use modprobe to test for the presence of lttng-modules
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Wed, 20 Mar 2019 21:49:00 +0000 (17:49 -0400)]
Fix: skip test when ust doesn't have perf support
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Mon, 25 Mar 2019 18:49:39 +0000 (14:49 -0400)]
Tests: check for lttng-modules presence
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Yannick Lamarre [Tue, 26 Mar 2019 19:53:06 +0000 (15:53 -0400)]
Fix: Properly sanitize input parameter
The lttng client uses the sizeof the containing buffer, defined as
LTTNG_SYMBOL_NAME_LEN, for input string sanitation instead of libc defined
macro NAME_MAX. lttng-enable_channel improperly verified user input
and wrongly discarded valid input in case NAME_MAX was less than the
sizeof the containing buffer for the channel's name.
This patch also fixes potential buffer overflow caused by an improperly
bounded strcpy in the case where NAME_MAX would have been greater than
LTTNG_SYMBOL_NAME_LEN.
Signed-off-by: Yannick Lamarre <ylamarre@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 19 Mar 2019 20:56:03 +0000 (16:56 -0400)]
Fix tests: link libpause_consumer on liblttng-ctl
This preload test library uses symbols from liblttng-ctl which are
resolved when preloaded by GLIBC but not by MUSL.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Wed, 13 Mar 2019 21:50:55 +0000 (17:50 -0400)]
tap-driver.sh: flush stdout after each test result
This is useful in a CI system where stdout is fully buffered and you
look at the console output to see which test is hanging.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 28 Mar 2019 15:18:38 +0000 (11:18 -0400)]
Fix tests: snapshot size validation failure runs too many test cases
The snapshot max size test is reported as both passing and failing
when the test case fails.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 12 Mar 2019 18:30:31 +0000 (14:30 -0400)]
Fix tests: the tree origin can be a symlink itself
Problem:
The base tree is defined as "/tmp/.....XXXXXX".
On systems where "/tmp/" is itself a symlink utils_expand_path will
expand the tree origin itself.
For example on a base core-image-minimal Yocto build /tmp is a symlink
to "/var/tmp", which is a symlink to "/var/volatile".
utils_expand_path will return something like this for the symlink test:
"/var/volative/.....XXXXXX/...." which is the valid result.
Solution:
Simply use realpath on the tree_origin and use this path to perform the
test validation.
This work was performed in the effort to support yocto fully and be able
to run the test suite to detect problem as early as possible.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 12 Mar 2019 18:30:30 +0000 (14:30 -0400)]
Fix tests: skip test_getcpu_override on single core systems
There is no value in performing this test on single-core system
since the only valid value for the cpu field is 0.
This test currently fails on single-core systems (i.e yocto runqemu)
on the test_getcpu_override_fail test case.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Yannick Lamarre [Fri, 22 Feb 2019 19:33:37 +0000 (14:33 -0500)]
Fix: Add POPT_CFLAGS to lttng_CFLAGS
The generated makefile was ignoring POPT_CFLAGS when compiling
lttng, but was adding POPT_LIBS to lttng_LDADD. With this commit,
make now honors both settings for applications and tests.
Fixes: #1165
Signed-off-by: Yannick Lamarre <ylamarre@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 19 Feb 2019 22:47:49 +0000 (17:47 -0500)]
Fix: consumer snapshot: handle unsigned long overflow
Comparing the consumed iterator and the produced position without
using a difference generates an empty snapshot when the iterator is
before unsigned long overflow and the produced position is after
unsigned long overflow.
This applies to both UST and kernel consumers.
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, 27 Mar 2019 19:42:19 +0000 (15:42 -0400)]
Fix: wrong error code returned by kernel_snapshot_record()
On snapshot error, kernel_snapshot_record() can return
LTTNG_ERR_KERN_CONSUMER_FAIL which means that the kernel consumer
daemon failed to launch. In this path, the appropriate error to
return is LTTNG_ERR_KERN_META_FAIL.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 22 Mar 2019 21:51:14 +0000 (17:51 -0400)]
Docs: document the format of the lttng_session path member
Document that the path returned through a session listing operation
is not a path nor standard URL. While a UNIX path will be returned
when a session is configured to trace locally, a liblttng-ctl user
should not expect this field to contain a valid URL when a network
streaming (or live) output destination is configured. The "path"
field will hold a custom-formatted string describing the output.
This is arguably unexepected, but since this is currently the only
way to obtain the destination of an existing session, this format
will not be changed to preserve compatiblity with existing tools
which could rely on this format.
A description of the formating used by the session daemon is
added as part of this patch.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 22 Mar 2019 21:51:40 +0000 (17:51 -0400)]
Fix: check illegal combinations of ctrl-url/data-url/ouput/set-url
The lttng CLI must check for illegal combinations of the
--ctrl-url, --data-url, --set-url, and --output options.
The following combinations are mutually exclusive:
1) --set-url
2) --ctrl-url + --data-url
3) --output
Combining these incompatible options resulted in unhelpful
generic error messages since the error is catched a lot farther
than it should.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 20 Dec 2018 21:16:47 +0000 (16:16 -0500)]
Remove duplicate check for dlopen
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 8 Feb 2019 01:25:41 +0000 (20:25 -0500)]
Tests: take multiple snapshots in streaming mode
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 8 Feb 2019 01:25:42 +0000 (20:25 -0500)]
Fix: don't destroy the sockets if the snapshot was successful
Missing a goto to skip the error condition that was destroying the
relayd sockets even if a snapshot was successful. We want to keep them
open to reuse them for the next snapshots.
This is verbatim from the fix
1371fc1228461eb532118280e67ab3e9de015757
It is also the same fix.
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, 23 Jan 2019 20:29:14 +0000 (15:29 -0500)]
Fix: missing rcu read locking in trigger "unregister all" command
While the notification subsystem all runs within a single thread,
the iteration over the triggers hash table must be protected using
the RCU read-side lock since the RCU worker may resize the hash
table while the iteration is performed.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 23 Jan 2019 20:28:36 +0000 (15:28 -0500)]
Fix: notification thread: RCU-safe reclaim of hash table nodes
Adapted from master branch commit
83b934ad.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 22 Jan 2019 18:55:01 +0000 (13:55 -0500)]
Update version to v2.10.6
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 6 Dec 2018 20:49:04 +0000 (15:49 -0500)]
Fix: worker structure is leaked in run_as process
The run_as structure (handle) is allocated and initialized before
the fork() that spawns the run_as process. Currently, that structure
is only cleaned-up on the parent's end.
This fix performs the clean-up on the worker's side as well.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 14 Jan 2019 22:13:32 +0000 (17:13 -0500)]
Fix: only free trace_path when it is dynamically allocated
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 12 Jan 2019 19:53:56 +0000 (14:53 -0500)]
Fix: leak of filter bytecode and expression on agent event re-enable
The agent subsystem does not properly assume the clean-up of an
event's filter bytecode and expression when a previously disabled
event is re-enabled.
This change ensures that the ownership of both the filter bytecode
and expression is assumed by the agent subsystem and discarded
when a matching event is found.
Steps to reproduce the leak:
$ lttng create
$ lttng enable-event --python allo --filter 'a[42] == 241'
$ lttng disable-event --python allo
$ lttng enable-event --python allo --filter 'a[42] == 241'
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 12 Jan 2019 19:21:24 +0000 (14:21 -0500)]
Test fix: python logging test spams its output
A set -x/+x pair was erroneously committed as part of the
test_python_logging test script which causes the test to be
unnecessarily verbose.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 11 Jan 2019 20:10:08 +0000 (15:10 -0500)]
Fix: leak of rundir config string
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 12 Dec 2018 22:37:54 +0000 (17:37 -0500)]
Fix: do not repurpose iterator while it is being used
The hash table iteration uses an iterator that needs to stay valid for
the next loop. Using that same iterator variable in a nested lookup in a
different hash table leads to segmentation fault.
This is a 2.10-specific instance of the issue affecting
bind_trigger_to_matching_channels() which was found in the
master and 2.11 branches. This one affects
handle_notification_thread_command_register_trigger().
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 13 Dec 2018 18:56:35 +0000 (13:56 -0500)]
Fix: run_command_wait() handle partial write
Use lttng_write() to handle partial writes (writing less than the
requested amount of bytes) as well as ret = -1, errno = EINTR.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 16 Nov 2018 18:25:00 +0000 (13:25 -0500)]
Fix: tests: test_crash should start sessions
test_crash expects side-effects of directory creation to happen while
tracing is still stopped. In preparation for changing that behavior,
ensure that tracing is started when those side-effects are expected.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 27 Nov 2018 19:24:27 +0000 (14:24 -0500)]
Add *.exe to gitignore for Cygwin
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 29 Nov 2018 21:49:51 +0000 (16:49 -0500)]
Fix: warning 'fd' may be used uninitialized
Initialize fd to invalid '-1' and remove unnecessary file_opened.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 13 Nov 2018 17:12:21 +0000 (12:12 -0500)]
Fix: max_t/min_t macros are missing cast on input
The semantic expected from max_t and min_t is to perform the max/min
comparison in the type provided as first parameter.
Cast the input parameters to the proper type before comparing them,
rather than after. There is no more need to cast the result of the
expression now that both inputs are cast to the right type.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 13 Nov 2018 17:12:20 +0000 (12:12 -0500)]
Fix: Connect timeout arithmetic in inet/inet6 (v4)
The nanoseconds part of the timespec struct time_a is not always
bigger than time_b since it wraps around each second.
Use 64-bit arithmetic to compute the difference.
Merge/move duplicated code into utils.c.
This function is really doing two things. Split it into
timespec_to_ms() and timespec_abs_diff().
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 14 Nov 2018 22:49:21 +0000 (17:49 -0500)]
Fix: create_channel_per_pid: remove channel on error
The notification system of the session daemon tracks the lifetime
of per-pid buffers (in effect, channel keys) using two hooks:
- the successful completion of create_channel_per_pid()
- the deletion of the channel from an application's registry
Multiple error paths in create_channel_per_pid() can leave a channel
in an app's registry without notifying the notification system of its
existence.
When the channel is finally cleaned-up, the channel deletion hook will
inform the notification system that the channel should be deleted,
resulting in an error as that channel was previously unknown.
This fix ensures we remove the application's channel from its registry
on error (with the notify parameter set to 'false'), thus ensuring
that the notification system never tracks the incomplete channel.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 14 Nov 2018 22:46:26 +0000 (17:46 -0500)]
Fix: channel errors on local stress-tests
On local stress-tests with per-pid buffers, error paths triggered
when trying to create a channel on an application already going away
end up tiggering the channel destruction with "-1" socket parameter.
This function attempts to send a notification of channel destruction
(erroneously) and attempts to sum counters into a channel object which
may not have been populated yet.
Therefore, don't perform those side-effects when invoked from error path
caused by channel creation error.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 14 Nov 2018 22:45:38 +0000 (17:45 -0500)]
Fix: channel_ust_create: remove channel on agent error
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 17 Oct 2018 21:16:12 +0000 (17:16 -0400)]
Always choose large event header for UST channels
UST can receive the session start command before all probe provider
library constructors have completed running, therefore finding less
events than eventually enabled within the process. Moreover, with
per-uid buffers, many processes end up registering events into shared
buffers. Therefore, the guess based on number of events from the first
process to use the buffer is incorrect.
Considering that we typically have applications with more than 30
events, we will modify the session daemon so it selects the "large"
header type independently of the number of events.
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, 5 Oct 2018 16:06:37 +0000 (12:06 -0400)]
Remove unnecessary check of output parameter
It is not necessary to check for `_notification != NULL` as it
is done at the beginning of the function. Moreover, it confuses
Coverity which warns that `notification` will be leaked if the
output parameter is NULL.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 11 Sep 2018 00:09:15 +0000 (20:09 -0400)]
Fix: perform local data pending before checking data pending with relayd
Performing the data pending check in two phases, local and network,
reduces the total number network operations needed.
Doing the local check first enable early return in cases where data is
still pending locally.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 11 Sep 2018 00:09:11 +0000 (20:09 -0400)]
Fix: double put on error path
Let relay_index_try_flush be responsible for the self-reference put on
error path.
Code flow of relay_index_try_flush is a bit tricky but the only error
flow (via relay_index_file_write) will always mark the index as flushed
and perform the self-reference put.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 11 Sep 2018 00:09:14 +0000 (20:09 -0400)]
Fix: holding the stream lock does not equate to having data pending
The live timer can hold the stream lock while sending empty beacon. An
empty beacon does not mean that data is still pending for the stream.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 11 Sep 2018 00:09:13 +0000 (20:09 -0400)]
Fix: skip uid registry when metadata key is 0
A value of zero for the metadata key indicate that metadata was never
created/pushed to the consumer.
This can occur in scenario were a tracker is present since metadata
might never be created/pushed.
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, 17 Sep 2018 22:15:11 +0000 (18:15 -0400)]
Docs: document the meaning of a ust app channel key set to 0
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 11 Sep 2018 00:09:12 +0000 (20:09 -0400)]
Fix: acquire stream lock during kernel metadata snapshot
The stream lock is not taken when interacting with the kernel
metadata stream that is created at the time a snapshot is taken.
This was noticed while reviewing the code for an unrelated reason,
so there is no known problem caused by this. Nevertheless, this
is incorrect as the stream is globally visible in the consumer.
Moreover, the stream was not cleaned-up which can cause a leak
whenever a metadata snapshot fails.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Jonathan Rajotte [Fri, 7 Sep 2018 19:18:38 +0000 (15:18 -0400)]
Fix: skip closed session on viewer listing
There is no value in listing a closed session. A viewer cannot hook
itself to a closed session in live mode and the session is about to be
removed from the sessions hash table.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 7 Sep 2018 19:18:37 +0000 (15:18 -0400)]
Fix: use LTTNG_VIEWER_ATTACH_UNK to report a closed session
LTTNG_VIEWER_NEW_STREAMS_HUP is not a valid error number for the
LTTNG_VIEWER_ATTACH_SESSION command. This result in erroneous error
reporting on the client side.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Mon, 17 Sep 2018 16:19:40 +0000 (12:19 -0400)]
Doc: withinin -> within
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Wed, 6 Jun 2018 01:00:28 +0000 (21:00 -0400)]
Fix: perform relayd socket pair cleanup on control socket error
A reference to the local context for the socket pair is used to "force" an
evaluation of the data and metadata streams since we changed the endpoint
status. This imitates what is currently done for the data socket.
This prevents hitting network timeouts multiple times in a row when an
error occurs. For now, there is no mechanism for retry hence
"terminating" all communication make sense and prevent unwanted delays
on operation.
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, 13 Sep 2018 21:04:45 +0000 (17:04 -0400)]
Fix: relayd control socket mutex is not destroyed
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 3 Jul 2018 18:49:23 +0000 (14:49 -0400)]
Tests: do not bound test app iterations when in background mode
On systems with a high number of CPUs and slow disk, taking snapshots
can take a long time. When running a long regression test, the tests
sometimes outlive the test application.
The test application then exits since the required number of
iterations was completed
(NR_ITER=
2000000).
Set the iterations parameter to -1 to ensure the application keeps
producing events for the duration of the test.
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, 11 Sep 2018 19:11:39 +0000 (15:11 -0400)]
Tests: add missing rotation and autoload tests to check target
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 5 Jul 2016 19:23:42 +0000 (15:23 -0400)]
Tests: remove temporary folder
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 5 Jul 2016 18:38:46 +0000 (14:38 -0400)]
Tests: remove mi result files when done
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.047603 seconds and 4 git commands to generate.