lttng-tools.git
7 years agoFix: unchecked return value in low throughput test
Mathieu Desnoyers [Tue, 17 May 2016 16:22:44 +0000 (12:22 -0400)] 
Fix: unchecked return value in low throughput test

Found by Coverity:

CID 1019967 (#1 of 1): Unchecked return value from library
(CHECKED_RETURN)2. check_return: Calling poll(NULL, 0UL, 60000) without
checking return value. This library function may fail and return an
error code.

We really don't care whether this poll succeeds or not.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: unchecked posix_fadvise() return value
Jérémie Galarneau [Tue, 17 May 2016 16:17:05 +0000 (12:17 -0400)] 
Fix: unchecked posix_fadvise() return value

Found by Coverity:

CID 1019971 (#1 of 1): Unchecked return value from library
(CHECKED_RETURN)2. check_return: Calling posix_fadvise(outfd,
orig_offset - stream->max_sb_size, stream->max_sb_size, 4) without
checking return value. This library function may fail and return an
error code.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: unchecked return value in relayd live.c
Mathieu Desnoyers [Tue, 17 May 2016 16:13:13 +0000 (12:13 -0400)] 
Fix: unchecked return value in relayd live.c

CID 1323137 (#1 of 1): Unchecked return value (CHECKED_RETURN)30.
check_return: Calling viewer_stream_get without checking return value
(as is done elsewhere 5 out of 6 times).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: unchecked return value in trace_clock_read64_monotonic
Mathieu Desnoyers [Tue, 17 May 2016 16:06:45 +0000 (12:06 -0400)] 
Fix: unchecked return value in trace_clock_read64_monotonic

Found by Coverity:

CID 1311498 (#1 of 1): Unchecked return value (CHECKED_RETURN)1.
check_return: Calling clock_gettime without checking return value (as is
done elsewhere 8 out of 9 times).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: initialize the cur_event variable before using it
Jonathan Rajotte [Tue, 17 May 2016 15:52:47 +0000 (11:52 -0400)] 
Fix: initialize the cur_event variable before using it

CID 1243041 (#1 of 1): Uninitialized scalar variable (UNINIT)
uninit_use_in_call: Using uninitialized element of array *cur_event.name when
calling strcmp.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: NULL pointer dereference in relay_index_get_by_id_or_create
Mathieu Desnoyers [Tue, 17 May 2016 14:44:25 +0000 (10:44 -0400)] 
Fix: NULL pointer dereference in relay_index_get_by_id_or_create

Found by Coverity:

CID 1323134 (#1 of 1): Dereference after null check (FORWARD_NULL)34.
var_deref_op: Dereferencing null pointer index.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: Deference after null check in sessiond set_option
Jérémie Galarneau [Wed, 18 May 2016 17:20:08 +0000 (13:20 -0400)] 
Fix: Deference after null check in sessiond set_option

Found by Coverity:

2. var_compare_op: Comparing arg to null implies that arg might be null.

CID 1256137 (#1 of 9): Dereference after null check (FORWARD_NULL)14.
var_deref_model: Passing null pointer arg to strdup, which dereferences
it.

[... same for #2 through #9 ]

This should not really be an issue since
1) options that use the "arg" parameter will not be set by popt if one
   is not provided,
2) the configuration file parser will never invoke set_option with
   a NULL argument; if no "value" is provided in the file, an empty
   string is passed.

The second point is the reason for the "arg && arg[0] == '\0'" check;
we already know that the argument is invalid since an empty string
is never a valid argument for the supported options.

Nonetheless, it makes sense for Coverity to flag this and moving
the check to individual cases, although very verbose, is clear.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: Wrong sizeof argument in pid tracker
Mathieu Desnoyers [Tue, 17 May 2016 13:23:50 +0000 (09:23 -0400)] 
Fix: Wrong sizeof argument in pid tracker

Found by Coverity:

CID 1292557 (#1 of 1): Wrong sizeof argument
(SIZEOF_MISMATCH)suspicious_sizeof: Passing argument 8UL /* sizeof
(*_pid_list) */ to function zmalloc and then casting the return value to
int * is suspicious.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: tests: incorrect uri index
Mathieu Desnoyers [Tue, 17 May 2016 13:20:17 +0000 (09:20 -0400)] 
Fix: tests: incorrect uri index

Initial issue found by Coverity:

CID 1322864 (#1 of 1): Constant expression result
(CONSTANT_EXPRESSION_RESULT)impossible_and: The "and" condition size ==
2L && (uri + 0).dtype == LTTNG_DST_IPV4 && (uri + 0).utype ==
LTTNG_URI_DST && (uri + 0).stype == 0U && (uri + 0).port == 8989 &&
strcmp((uri + 0).subdir, "my/test/path") == 0 && strcmp((uri +
0).dst.ipv4, "127.0.0.1") == 0 && (uri + 1).dtype == LTTNG_DST_IPV4 &&
(uri + 1).utype == LTTNG_URI_DST && (uri + 1).stype == 0U && (uri +
1).port == 4242 && strcmp((uri + 0).subdir, "my/test/path") == 0 &&
strcmp((uri + 1).dst.ipv4, "127.0.0.1") == 0 can never be true because
(uri + 0).subdir cannot be equal to two different values at the same
time.

Review of the test source file led to further fixes.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: Integer overflowed argument
Mathieu Desnoyers [Tue, 17 May 2016 13:11:39 +0000 (09:11 -0400)] 
Fix: Integer overflowed argument

Found by Coverity:

CID 1242317 (#1 of 2): Integer overflowed argument (INTEGER_OVERFLOW)25.
overflow_sink: Overflowed or truncated value (or a value computed from
an overflowed or truncated value) new_nbmem * 304UL used as critical
argument to function.

CID 1242317 (#2 of 2): Integer overflowed argument (INTEGER_OVERFLOW)27.
overflow_sink: Overflowed or truncated value (or a value computed from
an overflowed or truncated value) (new_nbmem - nbmem) * 304UL used as
critical argument to function.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: macro compares unsigned to 0 (no effect)
Mathieu Desnoyers [Tue, 17 May 2016 13:01:51 +0000 (09:01 -0400)] 
Fix: macro compares unsigned to 0 (no effect)

Found by Coverity:

CID 1262117 (#1 of 1): Macro compares unsigned to 0
(NO_EFFECT)unsigned_compare: This greater-than-or-equal-to-zero
comparison of an unsigned value is always true. events->nb_fd >= 0U.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: Free variable before strdup() in process_event_node
Michael Jeanson [Tue, 17 May 2016 18:12:09 +0000 (14:12 -0400)] 
Fix: Free variable before strdup() in process_event_node

Fixes coverity #1243040

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: Free variables before strdup()
Michael Jeanson [Tue, 17 May 2016 18:08:00 +0000 (14:08 -0400)] 
Fix: Free variables before strdup()

Fixes coverity #1243047 and #1243050

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: Add missing free() in spawn_viewer
Michael Jeanson [Mon, 16 May 2016 23:33:08 +0000 (19:33 -0400)] 
Fix: Add missing free() in spawn_viewer

Fixes coverity #1291948

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: Add missing free() in utils_partial_realpath
Michael Jeanson [Mon, 16 May 2016 23:27:30 +0000 (19:27 -0400)] 
Fix: Add missing free() in utils_partial_realpath

Fixes coverity #1328401

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in test_create_kernel_event
Mathieu Desnoyers [Tue, 17 May 2016 01:43:01 +0000 (21:43 -0400)] 
Fix: illegal memory access in test_create_kernel_event

Found by Coverity:
CID 1243030 (#1 of 1): Buffer not null terminated (BUFFER_SIZE_WARNING)1.
buffer_size_warning: Calling strncpy with a maximum size argument of 256
bytes on destination array ev.name of size 256 bytes might leave the
destination string unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in send_viewer_streams
Mathieu Desnoyers [Tue, 17 May 2016 01:42:59 +0000 (21:42 -0400)] 
Fix: illegal memory access in send_viewer_streams

Found by Coverity:

CID 1243037 (#1 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)18. buffer_size_warning: Calling strncpy with a
maximum size argument of 4096 bytes on destination array
send_stream.path_name of size 4096 bytes might leave the destination
string unterminated.

CID 1243037 (#2 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)18. buffer_size_warning: Calling strncpy with a
maximum size argument of 255 bytes on destination array
send_stream.channel_name of size 255 bytes might leave the destination
string unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in viewer_list_sessions
Mathieu Desnoyers [Tue, 17 May 2016 01:42:58 +0000 (21:42 -0400)] 
Fix: illegal memory access in viewer_list_sessions

Found by Coverity:

CID 1243025 (#1 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)17. buffer_size_warning: Calling strncpy with a
maximum size argument of 64 bytes on destination array
send_session->hostname of size 64 bytes might leave the destination
string unterminated.

CID 1243025 (#2 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)17. buffer_size_warning: Calling strncpy with a
maximum size argument of 255 bytes on destination array
send_session->session_name of size 255 bytes might leave the destination
string unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in relayd_add_stream
Mathieu Desnoyers [Tue, 17 May 2016 01:42:57 +0000 (21:42 -0400)] 
Fix: illegal memory access in relayd_add_stream

Found by Coverity:

CID 1243017 (#1 of 4): Buffer not null terminated
(BUFFER_SIZE_WARNING)14. buffer_size_warning: Calling strncpy with a
maximum size argument of 264 bytes on destination array msg.channel_name
of size 264 bytes might leave the destination string unterminated.

ID 1243017 (#2 of 4): Buffer not null terminated
(BUFFER_SIZE_WARNING)14. buffer_size_warning: Calling strncpy with a
maximum size argument of 264 bytes on destination array
msg_2_2.channel_name of size 264 bytes might leave the destination
string unterminated.

CID 1243017 (#3 of 4): Buffer not null terminated
(BUFFER_SIZE_WARNING)15. buffer_size_warning: Calling strncpy with a
maximum size argument of 4096 bytes on destination array msg.pathname of
size 4096 bytes might leave the destination string unterminated.

CID 1243017 (#4 of 4): Buffer not null terminated
(BUFFER_SIZE_WARNING)15. buffer_size_warning: Calling strncpy with a
maximum size argument of 4096 bytes on destination array
msg_2_2.pathname of size 4096 bytes might leave the destination string
unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in relayd_create_session_2_4
Mathieu Desnoyers [Tue, 17 May 2016 01:42:56 +0000 (21:42 -0400)] 
Fix: illegal memory access in relayd_create_session_2_4

Found by Coverity:
CID 1243024 (#1 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)2. buffer_size_warning: Calling strncpy with a
maximum size argument of 255 bytes on destination array msg.session_name
of size 255 bytes might leave the destination string unterminated.

CID 1243024 (#2 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)3. buffer_size_warning: Calling strncpy with a
maximum size argument of 64 bytes on destination array msg.hostname of
size 64 bytes might leave the destination string unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in session_create
Mathieu Desnoyers [Tue, 17 May 2016 01:42:55 +0000 (21:42 -0400)] 
Fix: illegal memory access in session_create

Found by Coverity:

CID 1323138 (#1 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)3. buffer_size_warning: Calling strncpy with a
maximum size argument of 64 bytes on destination array session->hostname
of size 64 bytes might leave the destination string unterminated.

CID 1323138 (#2 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)3. buffer_size_warning: Calling strncpy with a
maximum size argument of 255 bytes on destination array
session->session_name of size 255 bytes might leave the destination
string unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in consumer_set_subdir
Mathieu Desnoyers [Tue, 17 May 2016 01:42:54 +0000 (21:42 -0400)] 
Fix: illegal memory access in consumer_set_subdir

Found by Coverity:
CID 1243015 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING)8. buffer_size_warning: Calling strncpy with a
maximum size argument of 4096 bytes on destination array
consumer->subdir of size 4096 bytes might leave the destination string
unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in syscall_init_table
Mathieu Desnoyers [Tue, 17 May 2016 01:42:53 +0000 (21:42 -0400)] 
Fix: illegal memory access in syscall_init_table

Found by Coverity:
CID 1243021 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING)25. buffer_size_warning: Calling strncpy with a
maximum size argument of 255 bytes on destination array (syscall_table +
index).name of size 255 bytes might leave the destination string
unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in write_pidfile
Mathieu Desnoyers [Tue, 17 May 2016 01:42:52 +0000 (21:42 -0400)] 
Fix: illegal memory access in write_pidfile

Found by Coverity:
CID 1243023 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING)3. buffer_size_warning: Calling strncpy with a
maximum size argument of 4096 bytes on destination array pidfile_path of
size 4096 bytes might leave the destination string unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in list_lttng_channels
Mathieu Desnoyers [Tue, 17 May 2016 01:42:51 +0000 (21:42 -0400)] 
Fix: illegal memory access in list_lttng_channels

Found by Coverity:
CID 1243018 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING)11. buffer_size_warning: Calling strncpy with a
maximum size argument of 256 bytes on destination array (channels +
i).name of size 256 bytes might leave the destination string
unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in cmd_snapshot_record
Mathieu Desnoyers [Tue, 17 May 2016 01:42:50 +0000 (21:42 -0400)] 
Fix: illegal memory access in cmd_snapshot_record

Found by Coverity:
CID 1243027 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING)20. buffer_size_warning: Calling strncpy with a
maximum size argument of 255 bytes on destination array tmp_output.name
of size 255 bytes might leave the destination string unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in output_init
Mathieu Desnoyers [Tue, 17 May 2016 01:42:49 +0000 (21:42 -0400)] 
Fix: illegal memory access in output_init

Found by Coverity:

CID 1243028 (#1 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)5. buffer_size_warning: Calling strncpy with a
maximum size argument of 255 bytes on destination array output->name of
size 255 bytes might leave the destination string unterminated.

CID 1243028 (#2 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)10. buffer_size_warning: Calling strncpy with a
maximum size argument of 4096 bytes on destination array
output->consumer->dst.trace_path of size 4096 bytes might leave the
destination string unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in consumer_set_network_uri
Mathieu Desnoyers [Tue, 17 May 2016 01:42:48 +0000 (21:42 -0400)] 
Fix: illegal memory access in consumer_set_network_uri

Found by Coverity:
CID 1243029 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING)31. buffer_size_warning: Calling strncpy with a
maximum size argument of 4096 bytes on destination array obj->subdir of
size 4096 bytes might leave the destination string unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in cmd_snapshot_list_outputs
Mathieu Desnoyers [Tue, 17 May 2016 01:42:47 +0000 (21:42 -0400)] 
Fix: illegal memory access in cmd_snapshot_list_outputs

Found by Coverity:

CID 1243031 (#1 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)22. buffer_size_warning: Calling strncpy with a
maximum size argument of 4096 bytes on destination array (list +
idx).ctrl_url of size 4096 bytes might leave the destination string
unterminated.

CID 1243031 (#2 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)26. buffer_size_warning: Calling strncpy with a
maximum size argument of 255 bytes on destination array (list +
idx).name of size 255 bytes might leave the destination string
unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in list_events
Mathieu Desnoyers [Tue, 17 May 2016 01:42:46 +0000 (21:42 -0400)] 
Fix: illegal memory access in list_events

Found by Coverity:
CID 1243022 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING)23. buffer_size_warning: Calling strncpy with a
maximum size argument of 256 bytes on destination array (tmp_events +
i).name of size 256 bytes might leave the destination string
unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in disable_event
Mathieu Desnoyers [Tue, 17 May 2016 01:42:45 +0000 (21:42 -0400)] 
Fix: illegal memory access in disable_event

Found by Coverity:
CID 1243016 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING)14. buffer_size_warning: Calling strncpy with a
maximum size argument of 256 bytes on destination array msg.name of size
256 bytes might leave the destination string unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in add_uri_to_consumer
Mathieu Desnoyers [Tue, 17 May 2016 01:42:43 +0000 (21:42 -0400)] 
Fix: illegal memory access in add_uri_to_consumer

Found by Coverity:

CID 1243038 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING)15. buffer_size_warning: Calling strncpy with a
maximum size argument of 4096 bytes on destination array
consumer->dst.trace_path of size 4096 bytes might leave the destination
string unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in init_ust_event_from_agent_event
Mathieu Desnoyers [Tue, 17 May 2016 01:42:42 +0000 (21:42 -0400)] 
Fix: illegal memory access in init_ust_event_from_agent_event

Found by Coverity:
CID 1321741 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING)1. buffer_size_warning: Calling strncpy with a
maximum size argument of 256 bytes on destination array
ust_event->attr.name of size 256 bytes might leave the destination
string unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: illegal memory access in _cmd_enable_event
Mathieu Desnoyers [Tue, 17 May 2016 01:42:41 +0000 (21:42 -0400)] 
Fix: illegal memory access in _cmd_enable_event

Found by Coverity:

CID 1321742 (#1 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)21. buffer_size_warning: Calling strncpy with a
maximum size argument of 256 bytes on destination array attr->name of
size 256 bytes might leave the destination string unterminated.

CID 1321742 (#2 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING)22. buffer_size_warning: Calling strncpy with a
maximum size argument of 256 bytes on destination array attr->name of
size 256 bytes might leave the destination string unterminated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoImplement lttng_strncpy safe string copy
Mathieu Desnoyers [Tue, 17 May 2016 01:42:40 +0000 (21:42 -0400)] 
Implement lttng_strncpy safe string copy

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: loading a session prints an error message but the load is successful
Jérémie Galarneau [Mon, 16 May 2016 16:10:19 +0000 (12:10 -0400)] 
Fix: loading a session prints an error message but the load is successful

Fixes #1013

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoSnapshot warning if there are no events in one of the domains
Jérémie Galarneau [Mon, 16 May 2016 05:20:47 +0000 (01:20 -0400)] 
Snapshot warning if there are no events in one of the domains

Remove the "no data" check from the UST snapshot code since

1) It would report that no data was recorded in the snapshot even
   if the kernel tracer had recorded events,
2) The kernel consumer does not seem to report such a condition,
   making it hard to perform the check without modifying the
   consumer.

The consumer interfaces could be modified to reliably provide
this information in the future.

However, this warning is not provided in the other tracing
modes, making its usefulness questionable. An empty snapshot is
still a valid trace and users should not always expect a trace
to contain events. Moreover, "warning" that no data was produced
implies an error may have occured and is probably as confusing
as opening an empty trace to the average user.

Fixes #1012

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoSnapshot: record: use same datetime for snapshot folder output
Jonathan Rajotte [Fri, 13 Nov 2015 15:36:47 +0000 (10:36 -0500)] 
Snapshot: record: use same datetime for snapshot folder output

Make sure that the ust snapshot is put under the same folder as the
kernel snapshot.

Fixes #970

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRefactor: move the snapshot type check into output type check
Jonathan Rajotte [Fri, 13 Nov 2015 15:30:01 +0000 (10:30 -0500)] 
Refactor: move the snapshot type check into output type check

Since for both sub-session type the boilerplate is the same
simply move the check for sub-session type presence to the inner
check of type output.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoconfigure.ac: check for an existing liburcu-cds symbol
Philippe Proulx [Tue, 10 May 2016 20:00:28 +0000 (16:00 -0400)] 
configure.ac: check for an existing liburcu-cds symbol

Fixes #1001

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoconfigure.ac: use macro for wrong liburcu error message
Philippe Proulx [Tue, 10 May 2016 19:51:17 +0000 (15:51 -0400)] 
configure.ac: use macro for wrong liburcu error message

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: wording of trace_matches is misleading
Jérémie Galarneau [Sat, 14 May 2016 20:27:20 +0000 (16:27 -0400)] 
Tests: wording of trace_matches is misleading

trace_matches reports a number of "events found" in a trace while it
actually counts the number of event_name matches.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTypo: catched -> caught
Michael Jeanson [Tue, 19 Apr 2016 20:34:55 +0000 (16:34 -0400)] 
Typo: catched -> caught

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoUpdate version to v2.7.2 v2.7.2
Jérémie Galarneau [Tue, 19 Apr 2016 18:21:37 +0000 (14:21 -0400)] 
Update version to v2.7.2

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoClean-up shm directory tree after freeing the channel
Jonathan Rajotte [Thu, 17 Mar 2016 20:18:14 +0000 (16:18 -0400)] 
Clean-up shm directory tree after freeing the channel

On NFS, an unlinked file that is still mmaped or unclosed is kept
around by creating a .nfsXXXX file since it may still be in use. [1]

This prevents the effective cleanup of the shm tree directory because
it happens before the userspace consumer shm handles table
cleanup. [2]

Moving the tree removal to lttng_ustconsumer_free_channel ensures that
the cleanup is done when the files are completely closed/unmapped.

[1] http://nfs.sourceforge.net/ Look for "silly rename"
[2] See channel_free subcall to shm_object_table_destroy

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTest: Add the lttng-runas worker process to the sessiond pids
Jérémie Galarneau [Thu, 10 Mar 2016 19:23:28 +0000 (14:23 -0500)] 
Test: Add the lttng-runas worker process to the sessiond pids

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoLimit the scope of IFS overwriting
Jonathan Rajotte [Thu, 8 Oct 2015 18:01:40 +0000 (14:01 -0400)] 
Limit the scope of IFS overwriting

The overwrite caused a folder ' ' to be created locally when running root tests.
Use while loop to preserve space in invalid filter string.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoDo not overwrite IFS globally but only locally
Jonathan Rajotte [Tue, 6 Oct 2015 19:41:41 +0000 (15:41 -0400)] 
Do not overwrite IFS globally but only locally

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: tests: use SIGSTOP for crash extraction test
Mathieu Desnoyers [Thu, 10 Mar 2016 16:13:37 +0000 (11:13 -0500)] 
Fix: tests: use SIGSTOP for crash extraction test

Ensure that SIGKILL being received only by some consumer processes don't
trigger clean shutdown of other consumer processes (due to hang up of
communication FD by the session daemon).

Fix this by invoking a SIGSTOP on both sessiond and consumerd, and wait
until we see those process state change to "stopped" before proceeding
to send the SIGKILL.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
CC: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Only save kernel enablers in session configuration
Jérémie Galarneau [Tue, 8 Mar 2016 17:08:12 +0000 (12:08 -0500)] 
Fix: Only save kernel enablers in session configuration

The session configuration serialization currently saves the
kernel enablers along with all enabled syscalls. In the case
where a syscall would be enabled with a given filter, this would
result in two events being enabled:

1) the syscall with its filter expression (the enabler)
2) the syscall on its own (an enabled syscall)

The observable effect of this is that the syscall ends up being
traced regardless of the filter's evaluation.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Only list kernel enablers when listing events
Jérémie Galarneau [Tue, 8 Mar 2016 17:06:14 +0000 (12:06 -0500)] 
Fix: Only list kernel enablers when listing events

lttng list would list kernel enablers and individual enabled
syscalls which would result in a confusing output.

For instance, enabling the "open" syscall with a filter would
result in a list output displaying both the enabler,
the syscall's name + its filter, and the syscall on its own,
without any mention of an enabled filter.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: syscalls hash table leaks when listing kernel events
Jérémie Galarneau [Tue, 8 Mar 2016 16:11:33 +0000 (11:11 -0500)] 
Fix: syscalls hash table leaks when listing kernel events

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTest fix: ignore stderr at every step of randstring
Jérémie Galarneau [Wed, 9 Mar 2016 20:49:24 +0000 (15:49 -0500)] 
Test fix: ignore stderr at every step of randstring

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTest fix: ignore stderr when generating random string
Jérémie Galarneau [Wed, 9 Mar 2016 20:26:37 +0000 (15:26 -0500)] 
Test fix: ignore stderr when generating random string

tr often reports a broken pipe when the head command exits
(after having received enough characters) which pollutes the
test output.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: test: use load_path instead of $1
Jonathan Rajotte [Thu, 14 Jan 2016 18:40:42 +0000 (13:40 -0500)] 
Fix: test: use load_path instead of $1

$1 is used for tap condition checking not the load path.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix warning when building Python bindings
Jérémie Galarneau [Tue, 23 Feb 2016 20:18:18 +0000 (15:18 -0500)] 
Fix warning when building Python bindings

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTest: prevent the spawning of a daemonized sessiond
Jonathan Rajotte [Tue, 8 Mar 2016 22:37:39 +0000 (17:37 -0500)] 
Test: prevent the spawning of a daemonized sessiond

Sets the default lttng-sessiond path to /bin/true to prevent the spawning
of a daemonized sessiond. This is necessary since 'lttng create' will spawn
its own sessiond if none is running. It also ensures that 'lttng create'
fails when no sessiond is running.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: There is more tests than the plan
Jonathan Rajotte [Thu, 15 Oct 2015 20:45:30 +0000 (16:45 -0400)] 
Fix: There is more tests than the plan

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: per-pid ust buffers flush race with application unregister
Mathieu Desnoyers [Wed, 24 Feb 2016 00:41:40 +0000 (19:41 -0500)] 
Fix: per-pid ust buffers flush race with application unregister

If an application exits between the moment we create the ust app session
(shadow copy) and the moment we send channels to the application,
sending channels may fail. If the application unregisters between the
the end of ust app session creation and the destroy that follows (ust
app session lock is released in between), we may see is_sent being
false.

This assert was initially there in the early days of lttng-tools when
the application was responsible for doing the flush. Now that the flush
has been moved to the consumer daemon, we don't need this assertion
anymore.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Use ipv6 loopback adress in test_uri
Michael Jeanson [Thu, 18 Feb 2016 17:45:13 +0000 (12:45 -0500)] 
Fix: Use ipv6 loopback adress in test_uri

Some older version of Debian/Ubuntu and maybe other distros won't set
localhost to point on ::1 in the system hosts file and use instead a
custom name like ip6-localhost or ipv6-locahost which is not
standardized across distros.

To work around this, use the ipv6 loopback address instead of localhost.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: report already enabled event error to client
Jérémie Galarneau [Sun, 14 Feb 2016 23:22:03 +0000 (18:22 -0500)] 
Fix: report already enabled event error to client

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Conflicts:
src/bin/lttng-sessiond/cmd.c

8 years agoTests fix: source utils.sh before using conf_proc_count
Jérémie Galarneau [Fri, 12 Feb 2016 21:41:49 +0000 (16:41 -0500)] 
Tests fix: source utils.sh before using conf_proc_count

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: use configured processor count in getcpu override tests
Jérémie Galarneau [Fri, 12 Feb 2016 16:19:22 +0000 (11:19 -0500)] 
Tests: use configured processor count in getcpu override tests

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Conflicts:
tests/regression/ust/getcpu-override/test_getcpu_override

8 years agoTests: use configured processor count in snapshot tests
Jérémie Galarneau [Fri, 12 Feb 2016 16:17:42 +0000 (11:17 -0500)] 
Tests: use configured processor count in snapshot tests

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: Introduce conf_proc_count()
Jérémie Galarneau [Fri, 12 Feb 2016 16:17:18 +0000 (11:17 -0500)] 
Tests: Introduce conf_proc_count()

Tests are using the nproc utility which return the number of
_available_ CPUs. The distinction between online, available and
configured CPUs is subtle, but important.

The number of "online" CPUs can change at runtime as CPUs are
hot-plugged. This could happen during a test and result in
unexpected results.

The number of "configured" CPUs includes any CPU which may be
offline at the time.

The number of "available" CPUs, which is what is returned by the
nproc utility, may differ from both "online" and "configured"
counts. This is the case in containers which are assigned to a
subset of configured CPUs.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: print a more precise test description in snapshot tests
Jérémie Galarneau [Fri, 12 Feb 2016 15:40:50 +0000 (10:40 -0500)] 
Tests: print a more precise test description in snapshot tests

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: handle negative clock offset for lttng-ust metadata
Mathieu Desnoyers [Mon, 8 Feb 2016 22:13:25 +0000 (17:13 -0500)] 
Fix: handle negative clock offset for lttng-ust metadata

In the unlikely situation where a system sets its hardware clock
(CLOCK_REALTIME) to 0 (Epoch) after boot, the difference

  monotonic - realtime

becomes negative.

Fixup this situation by returning a 0 offset in this case.

This ensures that trace viewer implementations (e.g. babeltrace) which
currently cannot handle the negative offset (known bug) still work with
the generated traces.

This patch should be applied to master and stable-2.7.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: do not print error and bug messages when quiet (-q) is present
Jonathan Rajotte [Mon, 11 Jan 2016 22:32:14 +0000 (17:32 -0500)] 
Fix: do not print error and bug messages when quiet (-q) is present

Conform to the lttng man page

fixes #988

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoUpdate version to v2.7.1 v2.7.1
Jérémie Galarneau [Thu, 7 Jan 2016 20:00:51 +0000 (15:00 -0500)] 
Update version to v2.7.1

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoBuild: fallback to AC_CHECK_LIBS when looking for popt and uuid
Jonathan Rajotte [Tue, 1 Dec 2015 20:19:01 +0000 (15:19 -0500)] 
Build: fallback to AC_CHECK_LIBS when looking for popt and uuid

Not all distro ship .pc so fallback to basic libs searching if necessary.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agotests/unit: fix object files' location
Samuel Martin [Tue, 1 Dec 2015 23:36:45 +0000 (00:36 +0100)] 
tests/unit: fix object files' location

Referring to *.o files under a .libs/ directory is not recommended
because this belongs to libtool's innards.

Indeed, libtool decides to place the *.o files in an
implementation-specific location:
- PIC *.o files go into a .libs/ directory;
- non-PIC *.o files are generated along side to their corresponding
  source files.

Using PIC objects to build executable is legit, thought it may
introduce some minor overhead at runtime.

However, hard-coding these PIC object files in the Makefile.am to build
executables breaks the build in case of static only build.

In this case, no PIC object files is generated, so the linker will not
found some of the needed objects files.

Changing these dependencies' path fixes the static build, keeping the
shared one ok, though the non-PIC object files are now always built.

Fixes #983.

Fix tested on git master and v2.6 with no change needed.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoconfigure.ac: fix static build
Samuel Martin [Sun, 22 Nov 2015 22:38:00 +0000 (23:38 +0100)] 
configure.ac: fix static build

For static build, some extra LDFLAGS may be needed.

Using PKG_CHECK_MODULES instead of AC_CHECK_LIB for librairy detection
allows to get all these flags. Then, the LIBS variable can be extended
with everything that is needed.

So, use PKG_CHECK_MODULES for popt and uuid detection; which both depend
on libintl.

This changes fixes build failures triggered with Buildroot, e.g.:
  http://autobuild.buildroot.net/results/0f1/0f1e015a0c5a5ac2beeb5011d31a1e0058a32a0d/build-end.log

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: close indexes when rotating the trace files in mmap mode
Jérémie Galarneau [Fri, 27 Nov 2015 20:47:01 +0000 (15:47 -0500)] 
Fix: close indexes when rotating the trace files in mmap mode

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: close indexes when rotating the trace files in splice mode
Julien Desfossez [Fri, 27 Nov 2015 17:12:44 +0000 (12:12 -0500)] 
Fix: close indexes when rotating the trace files in splice mode

The consumer needs to close the old index file when doing a file
rotation before opening a new one.
The relay does not have this problem (handled with refcounts).

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Don't spam session daemon logs on invalid UST context
Jérémie Galarneau [Thu, 19 Nov 2015 17:07:56 +0000 (12:07 -0500)] 
Fix: Don't spam session daemon logs on invalid UST context

Fixes #976

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Check for NULL hash tables on relay daemon teardown
Jérémie Galarneau [Mon, 2 Nov 2015 22:51:04 +0000 (17:51 -0500)] 
Fix: Check for NULL hash tables on relay daemon teardown

The relay daemon will log any "leaked" object on exit. However,
some errors encountered early-on during the daemon's
initialization may result in the teardown being executed with
uninitialized hash tables.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Verify directory's existence before calling mkdir
Jérémie Galarneau [Mon, 2 Nov 2015 16:39:59 +0000 (11:39 -0500)] 
Fix: Verify directory's existence before calling mkdir

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Unchecked NULL string in logging statement
Jérémie Galarneau [Fri, 23 Oct 2015 01:37:54 +0000 (21:37 -0400)] 
Fix: Unchecked NULL string in logging statement

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: include the filter expression in agent events' primary key
Alexandre Montplaisir [Fri, 11 Sep 2015 22:38:52 +0000 (18:38 -0400)] 
Fix: include the filter expression in agent events' primary key

Similar fix to a931962, but for filter expressions this time.

UST events's key already includes the filter bytecode, so adding the
string itself should not be needed.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix live timer calculation error
Mikael Beckius [Wed, 21 Oct 2015 19:48:29 +0000 (15:48 -0400)] 
Fix live timer calculation error

There is an calculation error for live timer. Variable
switch_timer_interval is based on microsecond, and it is not
right to assign switch_timer_interval mod 1000000 to var tv_nsec
which is based on nanosecond.

Signed-off-by: Mikael Beckius <mikael.beckius@windriver.com>
Signed-off-by: Jianchuan Wang <jianchuan.wang@windriver.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Remove dependency on glibc 2.12 caused by pthread_setname_np
Jérémie Galarneau [Wed, 30 Sep 2015 20:48:12 +0000 (16:48 -0400)] 
Fix: Remove dependency on glibc 2.12 caused by pthread_setname_np

prctl() can be used to set the same attribute set by
pthread_setname_np, but doesn't introduce a dependency on a newer
glibc. Using prctl(PR_SET_NAME) introduces a soft dependency on
Linux 2.6.9. However, the worker won't fail to launch if the call
fails as it is set out of convenience (debugger output).

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Log and ignore SIGINT and SIGTERM in run_as worker
Jérémie Galarneau [Tue, 29 Sep 2015 16:19:00 +0000 (12:19 -0400)] 
Fix: Log and ignore SIGINT and SIGTERM in run_as worker

The run_as worker is in the same process group as its parent and
will receive both SIGINT and SIGTERM. However, we want to give
the worker a chance to tear itself down gracefully when its
parent closes the command socket.

The run_as worker will now ignore these signals (although it will
log them) and wait for the parent to induce the teardown.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoUpdate version to v2.7.0 v2.7.0
Jérémie Galarneau [Thu, 24 Sep 2015 19:14:45 +0000 (15:14 -0400)] 
Update version to v2.7.0

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Handle EINTR of waipid in run-as worker
Jérémie Galarneau [Thu, 24 Sep 2015 18:20:42 +0000 (14:20 -0400)] 
Fix: Handle EINTR of waipid in run-as worker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Handle EINTR of waitpid when spawning a session daemon
Jérémie Galarneau [Thu, 24 Sep 2015 16:34:49 +0000 (12:34 -0400)] 
Fix: Handle EINTR of waitpid when spawning a session daemon

waitpid may fail for various reasons, being interrupted being
the most frequent. In such a case, status is left uninitialized
which results in the WIFSIGNALED and WIFEXITED macros returning
undefined value, resulting in surprising logging statements such
as "killed by signal 114".

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoAdd a LOG() macro which handles dynamic severity levels
Jérémie Galarneau [Thu, 6 Aug 2015 18:57:17 +0000 (14:57 -0400)] 
Add a LOG() macro which handles dynamic severity levels

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: tests: support systems where PAGE_SIZE is not 4096
Michael Jeanson [Tue, 22 Sep 2015 21:14:45 +0000 (17:14 -0400)] 
Fix: tests: support systems where PAGE_SIZE is not 4096

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTest: jul/log4j: use -a instead of '*' to disable all events
Jonathan Rajotte [Tue, 22 Sep 2015 17:55:34 +0000 (13:55 -0400)] 
Test: jul/log4j: use -a instead of '*' to disable all events

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoReword warning on event disable
Jérémie Galarneau [Tue, 22 Sep 2015 16:12:20 +0000 (12:12 -0400)] 
Reword warning on event disable

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoClean-up: Remove unused test launchers
Jérémie Galarneau [Tue, 22 Sep 2015 15:59:44 +0000 (11:59 -0400)] 
Clean-up: Remove unused test launchers

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoHelp: add -j -l -p option to help string
Jonathan Rajotte [Mon, 21 Sep 2015 22:43:57 +0000 (18:43 -0400)] 
Help: add -j -l -p option to help string

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoman: update disable-event section
Jonathan Rajotte [Mon, 21 Sep 2015 22:43:56 +0000 (18:43 -0400)] 
man: update disable-event section

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoUse empty event name on disable -a for ust and agent domain
Jonathan Rajotte [Mon, 21 Sep 2015 22:43:55 +0000 (18:43 -0400)] 
Use empty event name on disable -a for ust and agent domain

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: disable kernel event based on name and event type
Jonathan Rajotte [Mon, 21 Sep 2015 22:43:54 +0000 (18:43 -0400)] 
Fix: disable kernel event based on name and event type

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

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

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

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

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

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

Fixes #925

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

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

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

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

This has two direct effects:

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

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

Fixes #906

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

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

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

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

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

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

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

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

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