Jérémie Galarneau [Mon, 23 Mar 2020 23:12:26 +0000 (19:12 -0400)]
Fix: lttng-list: don't warn when the kernel domain has no channels
Some commands beside lttng-enable-channel have the side-effect of
creating a domain. For instance, the lttng-track and lttng-untrack
commands will implicitly create their target domains if they don't
exist. Thus, it is not unexpected for a domain to exist without
channels.
Currently, tracking process attributes in the user space and kernel
domains will result in a warning being printed when lttng-status
(or lttng-list `the_session`) is invoked.
Example output:
Tracing session arielle_bolduc: [inactive]
Trace output: /home/jgalar/lttng-traces/arielle_bolduc-
20200323-191128
=== Domain: Linux kernel ===
Tracked process attributes
Process IDs: all
Virtual Process IDs: 12365, 526, 41
User IDs: all
Virtual User IDs: all
Group IDs: all
Virtual Group IDs: all
Warning: No kernel channel
=== Domain: User space ===
Buffering scheme: per-user
Tracked process attributes
Virtual Process IDs: 12365, 526, 41
Virtual User IDs: all
Virtual Group IDs: all
The warning is removed since it can only confuse users.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I733ee6c3d8c1d297194842c7bdbdf3f237661e51
Jérémie Galarneau [Tue, 17 Mar 2020 20:14:30 +0000 (16:14 -0400)]
Refactor: lttng-ctl: follow terminology of the tracker documentation
This commit harmonizes the process attribute tracker API and
serialization formats (save/restore and MI) with the documentation
with regards to the terminology used.
The message of the parent commit adjusting the manual pages of the
lttng-track and lttng-untrack commands details those terminology
changes and their rationale.
Some problems with the API introduced during the 2.12 development
cycle are also adressed:
Type safety:
- The process attribute tracker is made type safe with regards
to the platform's native types to express process
attributes. Where the original API casted all integral values to
integers, this change introduces accessors for all process
attribute types (pid_t, uid_t, gid_t). This makes it easier to
use the API safely and without producing warnings in user's
code.
Another benefit of adopting this explicit type-safe approach is
that is will make it easier to add new attributes which are not
expressible (or non-ambiguously expressible) using `int` and
`string` types (e.g. tracking a virtual PID within a given
namespace).
Ambiguity of INCLUDE_ALL, EXCLUDE_ALL, and INCLUDE_SET states:
- The original tracker API has a notion of 'enabled' pid_tracker
which is confusing to users:
- enable = 0: everything is tracked,
- enable = 1: a list of tracked pids is provided, which may be
empty.
- pid '-1' is *special* and tracks or untracks everything.
This was replaced with a 'special' opaque value meaning 'ALL'
which, while being clearer, was still confusing and hard to
document.
The revised API explicitly expresses the notion of a tracking
policy (`enum lttng_tracking_policy`). When that policy is set
to `LTTNG_TRACKING_POLICY_INCLUDE_SET`, the inclusion set can
be queried and/or mutated.
On top of being clearer, this aligns more closely with the
internal lttng-sessiond daemon API which gets rid of a lot
of code to handle those special cases. The resulting code is
more verbose, but a lot easier to understand.
Moreover, the types introduced (e.g. lttng_process_attr_values)
are meant to be re-used if a new
`LTTNG_TRACKING_POLICY_EXCLUDE_SET` tracking policy is added in
the future.
Documentation:
- The revised API includes a complete documentation. It documents
the API usage, but also adds implementation notes such explicitly
mentionning when/where user names and group names are resolved.
Client:
- While making the changes to use this new API, some error messages
are clarified (or added). The resulting output when listing the
trackers was also changed to be more compact.
The CLI output now also makes use of the terminology used in
the documentation for all commands interacting with process
attribute trackers.
It is now also possible to specify multiple process attribute
trackers along with the --all option for the lttng-track and
lttng-untrack command. For instance: `lttng tracker --userspace
--vpid --vuid --all` is now allowed.
The same process attribute tracker can also be specified more than
once in a command, as follows:
`lttng track --userspace --vpid 43,11 --vpid 55,77`
Since the serialization had been changed during the 2.12 cycle, I
changed them further to use the API's terminology in the element
names.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I5f0ea2849eb024ea6944b2ee7dbadfd893cc0be4
Jérémie Galarneau [Fri, 20 Mar 2020 21:27:00 +0000 (17:27 -0400)]
lttng: list: replace domain headers with the official names
The lttng-list command uses the following domain headers
when printing domain listings:
- `Kernel`
- `UST global`
- `JUL (Java Util Logging)`
- `LOG4j (Logging for Java)`
- `Python (logging)`
Those don't match the official project names and/or names
used in the LTTng online documentation.
They are replaced by:
- `Linux kernel`
- `User space`
- `java.util.logging (JUL)`
- `log4j`
- `Python logging`
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I549b309eebf0d00dfaacbed00e263f4e5e3d718b
Jérémie Galarneau [Fri, 20 Mar 2020 21:17:34 +0000 (17:17 -0400)]
lttng: list: print `per-user` and `per-process` buffer types
The lttng-list command prints `per UID` and `per PID` for the
buffer type which is inconsistent with the terms used in the
documentation.
Moreover, `Buffer type` is replaced by `Buffering scheme` for
the same reason.
Change the print-out to match the online documentation.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id20098386ec0369fae017d01786ecc13c78820c0
Jérémie Galarneau [Wed, 4 Mar 2020 21:37:32 +0000 (16:37 -0500)]
Docs: overhaul of lttng-track(1) and lttng-untrack(1)
- Replace the term whitelist by "inclusion set"
The use of whitelist (and its counterpart, blacklist) is somewhat
controversial and doesn't align with the terms used in the tracker
API.
The "inclusion set" nomenclature is inspired by that used by ACL,
namely "include list" and "exclude list". Set is preferred to list
as there is no implied notion of order.
- Adapt process attribute descriptions
The process attribute descriptions were apparently copy-pasted from
the original PID description (all are referencing "process IDs").
A suitable description is added for each process attribute.
- Add new process attributes to lttng-untrack(1)
The lttng-untrack man page was not updated when the resource types
introduced in LTTng 2.12 were added to lttng-track(1).
- Group all process attributes with their 'virtual' counter-parts
The order in which process attributes were described was: pid, uid,
gid, vpid, vuid, vgid.
Grouping process attributes with their virtual counterpart (e.g. pid
followed by vpid) makes it easier to understand the difference at a
glance.
The order becomes: pid, vpid, uid, vuid, gid, vgid
- Remove all PID-specific wordings in lttng-untrack(1)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I46486c4e90003da3e860682f6c22a0e4a154492b
Jérémie Galarneau [Thu, 19 Mar 2020 01:02:03 +0000 (21:02 -0400)]
Fix: MI: bump MI schema version to 4.0 in mi-lttng.c
The MI schema has been bumped to 4.0, but the internal constant
in mi-lttng.c still indicates a 3.0 schema. Synchronize both
versions to 4.0 for the 2.12 release.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia27e15e2c154b2fd39eeaaa6c71df922a233bc80
Jérémie Galarneau [Thu, 5 Mar 2020 21:52:32 +0000 (16:52 -0500)]
Fix: sessiond: occasional badfd error on repeated SIGTERM
The session daemon occasionally prints the following messages
when it received multiple SIGTERM signals:
PERROR - 16:50:18.
505585257 [49845/49845]: write poll pipe: Bad file
descriptor (in notify_thread_pipe() at utils.c:35)
This is caused by a (somewhat inevitable) race between the teardown of
the daemon and the closing of its quit pipe. This happens more often
when kernel modules take a long time to be unloaded and the user
spams ctrl+c in the hope of convincing the daemon process to close
faster since modules are unloaded after closing the quit pipe.
Setting closed pipe fds to '-1' is safe anyway and is already
handled by the notify_thread_pipe() util.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If08a455c65055dcb56ffbad3703173e6a45cfba5
Jérémie Galarneau [Wed, 4 Mar 2020 23:27:28 +0000 (18:27 -0500)]
Fix: lttng: incorrect domain list printed when no domain is provided
The following commands make use of a common utility function to
validate the count of domains specified and print an error when it
is invalid:
- lttng-enable-event,
- lttng-disable-event,
- lttng-track,
- lttng-untrack,
- lttng-add-context,
- lttng-enable-channel,
- lttng-disable-channel.
Those commands do not allow the same domains to be used. In fact, they
all expect --kernel or --userspace only, except for the
lttng-enable-event, lttng-disable-event, and lttng-add-context
commands which allow the --log4j, --jul, and --python domain options
to be used.
Currently, the error message when no domain is specified is incorrect
for all of those commands. The error reads as follows:
`Error: Please specify a domain (-k/-u/-j).`
For most commands, the -j option cannot be used. For those that allow
agent domains, the message is missing the -l and -p domains.
This ensures that the expected domains are printed for each of those
commands.
Moreover, the message is clarified by using the long form option
names.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I45aee075dbf6c62c4120bdeb06697b88b2d8716c
Simon Marchi [Thu, 13 Feb 2020 15:36:31 +0000 (10:36 -0500)]
Fix all -Wdiscarded-qualifiers warning instances
Change-Id: I85246856d284d5a2dad9609f5fb06d32a89dbb7c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 17 Mar 2020 23:04:32 +0000 (19:04 -0400)]
Remove part of last name to fit in a 80 character line
It plays much more nicely with the .clang-format since it ensure that
the line stay inside the 80 column limit.
It also match my signed-off and other files already present in the
project.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: Ib1ce1f101e9f24c03a05888b5fb1901341d8c005
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Tue, 17 Mar 2020 21:48:40 +0000 (17:48 -0400)]
Fix: Tests: trace path wildcards not expanded
Issue
=====
Some testcases related to `--live` sessions in
`tools/clear/{test_ust,test_kernel}` fail with the following error:
ls: cannot access '/tmp/tmp.gi1eVM3fZ9/tmp.dNL0WHRTQ3/ci-node-bionic-amd64-02-04/LUP49x7iV7xexehS*': No such file or directory
not ok 61 - Failed to list content of directory "/tmp/tmp.gi1eVM3fZ9/tmp.dNL0WHRTQ3/ci-node-bionic-amd64-02-04/LUP49x7iV7xexehS*"
FAIL: tools/clear/test_ust 61 - Failed to list content of directory "/tmp/tmp.gi1eVM3fZ9/tmp.dNL0WHRTQ3/ci-node-bionic-amd64-02-04/LUP49x7iV7xexehS*"
# Failed test 'Failed to list content of directory "/tmp/tmp.gi1eVM3fZ9/tmp.dNL0WHRTQ3/ci-node-bionic-amd64-02-04/LUP49x7iV7xexehS*"'
# in ./tools/clear//../../../utils/tap/tap.sh:fail() at line 159.
They fail because the wildcard character `*` is used in a path and is
not expanded when comes the time to list the content of the expanded
path.
In `--live` related tests, we use a wildcard in those paths because we
can't know the full name of the output directory as it's named by the
sessiond.
This bug was introduced (or rather not fixed) by the following commit:
commit
94360c17201a28466af49058735166c73f9ae130
Author: Francis Deslauriers <francis.deslauriers@efficios.com>
Date: Fri Mar 6 18:18:14 2020 -0500
Fix: Tests: utils.sh: merge `validate_{directory,folder_is}_empty` functions
Solution
========
Remove the double quotes around the path variable so that wildcards can
be expanded as expected.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: If4a72fab0d487cf6e6b021dfad9eca6d0d60d5f4
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Wed, 4 Mar 2020 21:18:37 +0000 (16:18 -0500)]
Fix: Tests: `gen-ust-events` doesn't error out on invalid option
Issue
=====
When running `gen-ust-events` with an invalid option:
./gen-ust-events -h
The `getopt_long()` function prints the following error:
./gen-ust-events: invalid option -- 'h'
which is very kind of it.
The problem is that the process keep running and go on to generate
events. It should exit right away.
Solution
========
Remove the `break` statement and so that we execute the `goto end`
right away.
Apply the same changes to `gen-ust-nevents`.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ib1c96f4c9ed8f98395bf842215f858a69db2bbf0
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Fri, 6 Mar 2020 23:18:14 +0000 (18:18 -0500)]
Fix: Tests: utils.sh: merge `validate_{directory,folder_is}_empty` functions
Issues
======
1. Both functions aim to do the same thing.
2. The current `validate_folder_is_empty` function uses an erroneous
way of checking if a folder is empty. `ls -A` returns zero on
success; it doesn't return the number of files and sub-folders. A
correct way to get the number of elements in a directory is to pipe
the output of `ls -A` to `wc -l`.
3. The `local_path` variable is used undefined in the current
`validate_directory_empty` function.
It just happens that the `local_path` variable is defined in all
but one of the callsites of this function so those calls work as
expected.
The other call to this function was
bogus (tests/regression/tools/clear/test_ust:323) because it uses
the `$TRACE_PATH` variable name.
Fixes
=====
- Merge both functions into one, keeping the name
`validate_directory_empty`,
- Fix the emptiness check,
- Fix usages of `validate_directory_empty` in tests.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Id75baf16f42866e3b978389f9aada4a2f6b6f2ae
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Thu, 5 Mar 2020 19:09:51 +0000 (14:09 -0500)]
Fix: Tests: undefined `NR_USEC_WAIT` bash variable
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I18eff11e47340245c595d4883f280d0fed23ca48
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 9 Mar 2020 14:49:51 +0000 (10:49 -0400)]
directory-handle: print `errno` reason on `unlinkat()` error
This is helpful while troubleshooting clear and rotation issues.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I92f9551a49fced7603c8dca832566de71b188528
Jonathan Rajotte [Tue, 3 Mar 2020 20:30:10 +0000 (15:30 -0500)]
Fix: lttng-ctl: _handle can be NULL
lttng_destroy_session_no_wait does not care for the returned handle
and passes a NULL _handle.
This leads to an immediate LTTNG_ERR_INVALID failure on
lttng_destroy_session_no_wait calls.
lttng_destroy_session_ext already performs a null check on _handle
before assigning it to transfer ownership of the handle.
Fixes #1241
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I9e8bee28382fa2250dee720037efdf77b4e776b8
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Mon, 9 Mar 2020 18:45:20 +0000 (14:45 -0400)]
Fix: sessiond: domain subdirectory not deleted on empty clear
Scenario
=====
$ lttng create
$ lttng enable-event -u -a
$ lttng start
// no events are produced.
$ lttng clear
Sessiond fails on clear with this message:
Error: Error removing subdirectory '.tmp_new_chunk' file when deleting
chunk
Cause
=====
The "ust" domain directory is still present preventing the removal of
the ".tmp_new_chunk" directory.
Solution
=====
Use lttng_trace_chunk_create_subdirectory, ensuring that the domain
folder is moved/deleted as necessary.
Fixes #1244
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I81d23ffc9f330f50f718957d460ee7a2718c95a1
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Thu, 13 Feb 2020 15:35:34 +0000 (10:35 -0500)]
Ignore -Wincomplete-setjmp-declaration warnings
We currently get this when building a test that requires UST:
make[4]: Entering directory '/home/smarchi/build/lttng-tools-clang/tests/regression/ust/linking'
CC tp.lo
In file included from /home/smarchi/src/lttng-tools/tests/regression/ust/linking/tp.c:11:
In file included from /home/smarchi/src/lttng-tools/tests/regression/ust/linking/./ust_tests_demo.h:38:
In file included from /home/smarchi/install/include/lttng/tracepoint-event.h:58:
In file included from /home/smarchi/install/include/lttng/ust-tracepoint-event.h:28:
In file included from /home/smarchi/install/include/lttng/ust-events.h:41:
/usr/include/pthread.h:744:12: error: declaration of built-in
function '__sigsetjmp' requires the declaration of the 'jmp_buf'
type, commonly provided in the header
<setjmp.h>. [-Werror,-Wincomplete-setjmp-declaration]
extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
^
I'm not sure what we can do about it, and I believe the warning is
bogus. I do have a definition for the "jmp_buf" type in
/usr/include/setjmp.h:
typedef struct __jmp_buf_tag jmp_buf[1];
And even with I include <setjmp.h>, the warning does not go away. I'm
not sure if that's right, but this patch disables the warning.
Change-Id: Ibe7451dc0afc9aaca59431296d42011d9e4306f9
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Thu, 13 Feb 2020 15:36:04 +0000 (10:36 -0500)]
tests: put -no-pie in LDFLAGS instead of CFLAGS
When building with clang, we get:
make[4]: Entering directory
'/home/smarchi/build/lttng-tools-clang/tests/utils/testapp/gen-syscall-events-callstack'
CC gen-syscall-events-callstack.o
clang: error: argument unused during compilation: '-no-pie'
[-Werror,-Wunused-command-line-argument]
Indeed, -no-pie should be in LDFLAGS, not CFLAGS.
To make sure that Makefiles can use `AM_LDFLAGS += ...`, I have added
an AC_SUBST for AM_LDFLAGS in configure.ac. This makes it so that if
we ever set AM_LDFLAGS for real in configure.ac, the Makefiles won't
inadvertently overwrite that value.
Change-Id: I7bad985bb135e50750917db6a928f2705a85b445
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 10 Mar 2020 02:06:01 +0000 (22:06 -0400)]
Silence `POSIX Yacc` warnings
Flex/Bison warn that we make use of two non-POSIX directives,
%code and %define. Coincidentally, we don't use POSIX Yacc!
From the bison documentation, "[...] -Wno-yacc will hide the warnings
about POSIX Yacc incompatibilities." [1].
Thus, this flag is added to the YFLAGS.
YACC filter-parser.c
/home/jgalar/EfficiOS/src/lttng-tools/src/lib/lttng-ctl/filter/filter-parser.y:293.1-5:
warning: POSIX Yacc does not support %code [-Wyacc]
293 | %code provides
| ^~~~~
/home/jgalar/EfficiOS/src/lttng-tools/src/lib/lttng-ctl/filter/filter-parser.y:301.1-7:
warning: POSIX Yacc does not support %define [-Wyacc]
301 | %define api.pure
| ^
[1] https://www.gnu.org/software/bison/manual/html_node/Diagnostics.html
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iaf65534bc47514d3a99b97ce414880a6afc723b9
Simon Marchi [Mon, 25 Nov 2019 20:32:19 +0000 (15:32 -0500)]
Fix -Wmissing-declarations warnings in filter-parser.y
Make gc_string_append and yyerror static, as they are only used in
this file.
Remove yywrap, apparently, it's not used. This probably has to do
with the fact that our lexer uses the noyywrap option.
setstring is used by filter-lexer.c (generated from filter-lexer.l),
which has its own local setstring declaration. This is not very good,
because the prototype of setstring could change in the implementation,
and the users of the function would still compile, but then it would
probably crash inexplicably at runtime.
Instead, put the declaration in filter-parser.h, using a "%code
provides" directive. That seems to be the intent of "%code provides"
[1]:
Purpose: This is the best place to write additional definitions and
declarations that should be provided to other modules.
[1] https://www.gnu.org/software/bison/manual/html_node/_0025code-Summary.html
Change-Id: I04ce69ae9808b72e96bf9e602772f0e5758dfc10
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:39:22 +0000 (15:39 -0500)]
Include cmd-2-2.h in cmd-2-1.h
Fixes:
CC cmd-2-2.o
/home/smarchi/src/lttng-tools/src/bin/lttng-relayd/cmd-2-2.c:36:5:
error: no previous declaration for ‘cmd_recv_stream_2_2’
[-Werror=missing-declarations] int cmd_recv_stream_2_2(const
struct lttng_buffer_view *payload, ^~~~~~~~~~~~~~~~~~~
... and helps ensure that the declarations are in sync with the
definitions.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I889d7306c157b0d68d24bf610fce18c8949422d8
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:00:56 +0000 (16:00 -0500)]
Make create_file function static in gen-ust-tracef.c
Fixes:
CC gen-ust-tracef.o
/home/smarchi/src/lttng-tools/tests/utils/testapp/gen-ust-tracef/gen-ust-tracef.c:36:6:
error: no previous declaration for ‘create_file’
[-Werror=missing-declarations] void create_file(const char *path)
^~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I12359b30054da609be2aca998de960719120083e
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:16:32 +0000 (16:16 -0500)]
Make remove_file_from_hierarchy function static in test_directory_handle.c
Fixes:
CC test_directory_handle.o
/home/smarchi/src/lttng-tools/tests/unit/test_directory_handle.c:139:5:
error: no previous declaration for ‘remove_file_from_hierarchy’
[-Werror=missing-declarations] int
remove_file_from_hierarchy(struct
lttng_directory_handle *test_dir_handle,
^~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I060a89d88f2de8e12368496968708d273cb318f2
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:17:37 +0000 (16:17 -0500)]
Make fd_count function static in test_fd_tracker.c
Fixes:
CC test_fd_tracker.o
/home/smarchi/src/lttng-tools/tests/unit/test_fd_tracker.c:65:5:
error: no previous declaration for ‘fd_count’
[-Werror=missing-declarations] int fd_count(void) ^~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I02775d5d601211052b4cad323bc33623beabc8f9
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:21:52 +0000 (16:21 -0500)]
Add declarations for exported functions in health_exit.c
Silences a bunch of -Wmissing-declarations warnings.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ib8ca00c2f9eaeec1821a15c3978d988e58804367
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:25:52 +0000 (16:25 -0500)]
Add declarations for exported functions in health_fail.c
Silences a bunch of -Wmissing-declarations warnings.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: If909cb5552aa9a8c9602410cbc608dd57a152e9f
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:27:13 +0000 (16:27 -0500)]
Make functions in live_test.c static
Fixes:
CC live_test.o
/home/smarchi/src/lttng-tools/tests/regression/tools/live/live_test.c:154:5:
error: no previous declaration for ‘establish_connection’
[-Werror=missing-declarations] int establish_connection(void)
^~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/regression/tools/live/live_test.c:198:5:
error: no previous declaration for ‘list_sessions’
[-Werror=missing-declarations] int
list_sessions(uint64_t *session_id) ^~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/regression/tools/live/live_test.c:245:5:
error: no previous declaration for ‘create_viewer_session’
[-Werror=missing-declarations] int create_viewer_session(void)
^~~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/regression/tools/live/live_test.c:283:5:
error: no previous declaration for ‘attach_session’
[-Werror=missing-declarations] int attach_session(uint64_t id)
^~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/regression/tools/live/live_test.c:372:5:
error: no previous declaration for ‘get_metadata’
[-Werror=missing-declarations] int get_metadata(void) ^~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/regression/tools/live/live_test.c:466:5:
error: no previous declaration for ‘get_next_index’
[-Werror=missing-declarations] int get_next_index(void)
^~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/regression/tools/live/live_test.c:631:5:
error: no previous declaration for ‘detach_viewer_session’
[-Werror=missing-declarations] int detach_viewer_session(uint64_t
id) ^~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I7dc82076439e1bccd7bc253d084291f6281f6887
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:28:16 +0000 (16:28 -0500)]
Add declarations for exported functions in consumer_testpoints.c
Silences some -Wmissing-declarations warnings.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Icb6b79ea5ad4a076a6ae03c61b9f0691d45f3c1c
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:29:04 +0000 (16:29 -0500)]
Make parse_arguments static in base_client.c
Fixes:
CC base_client.o
/home/smarchi/src/lttng-tools/tests/regression/tools/notification/base_client.c:60:5:
error: no previous declaration for ‘parse_arguments’
[-Werror=missing-declarations] int parse_arguments(char **argv) {
^~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I4e431009d6e174eaadd82d206f9bedde9efdd30b
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:41:29 +0000 (16:41 -0500)]
Fix all -Wmissing-declarations warning instances
This fixes all the remaining -Wmissing-declarations warning occurences.
The changes either:
- Make functions static
- Remove unused functions
- Add declarations for functions that are meant to be exported in a
shared object to override some other function (e.g.
lttng_ust_clock_plugin_init). There isn't really a better place for
these declarations.
Change-Id: If08855b75bf44dfdcfbdd654c272474ad8ebef39
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 2 Mar 2020 22:45:17 +0000 (17:45 -0500)]
Fix: fd-tracker: mark symbols as hidden
The fd-tracker is part of libcommon and, as such, its symbols must be
marked as hidden since it is linked into liblttng-ctl.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I007d950c0e3f7e059ba372c4d20b096c3069febb
Jérémie Galarneau [Mon, 2 Mar 2020 22:12:17 +0000 (17:12 -0500)]
Fix: liblttng-ctl: hide new tracker config symbols
Session configuration constants are supposed to remain internal.
Some symbols were errneously exported in previous releases, but
we mark new ones as "hidden".
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iae51c7e479ba9f9e377bb426f35f9e3a73c2d449
Jérémie Galarneau [Mon, 2 Mar 2020 19:48:41 +0000 (14:48 -0500)]
Tests: remove unused libhealthexit code
libhealthexit is no longer used since
89c453960. Remove the now-unused
code of that test library. A comment referencing that library is also
adjusted.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1d088e9032a3b2e1a9f7956e81c7cb662473a7fd
Jérémie Galarneau [Fri, 28 Feb 2020 23:02:17 +0000 (18:02 -0500)]
Fix: remove broken health monitoring test `test_thread_exit`
The `test_thread_exit` test uses the testpoint() infrastructure to
simulate daemon threads dying at "random" times by calling
pthread_exit() and checks that dead threads are properly reported by
the health check API.
The health check system is implemented as a list of structures that
live in the TLS of the various monitored threads. When the health
thread receives a health-check request, it iterates on this list and
reports the current health status of the threads to the client.
When a thread is stalled, this works fine; the health TLS has not been
updated in some time and that can be observed by the client. However,
for a 'spurious' thread exit, this is a bit more fragile.
Essentially, the test assumes that the thread will not have
unregistered its health TLS, but that it will remain valid until the
thread is joined.
Unfortunately, this behaviour relies on the fact that threads were not
joined until late in the tear down of the session daemon in the
past. This is no longer the case for all threads.
To provide an example of a test sequence that results in a
crash:
- the test kills the client thread,
- the session daemon received SIGTERM,
- the client thread is joined immediately,
- the next thread to shutdown (gracefully) unregisters itself from
the health monitoring sybsystem and, in doing so, accesses an
invalid element while removing itself from the health_app list,
causing a crash.
As a side note, I could not find a definitive answer on the lifetime
of TLS variables. Are they guaranteed to be accessible until a
pthread_join() or is it undefined to access them after a thread has
returned? I'm guessing this is a very internal implementation detail
of the pthread implementation being used and that we should not rely
on that behaviour.
There are multiple ways we could fix this problem, such as using
heap-allocated structures and ref-counting them to share ownership
with the health thread, using pthread_atexit() to clean-up, etc.
However, the LTTng daemons never pthread_exit() their threads to
handle errors (or even call it directly); handling this behaviour is
of dubious interest at the moment.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I16ec70eb683832fe5f2810885c995988b6194690
Jérémie Galarneau [Tue, 18 Feb 2020 01:13:49 +0000 (20:13 -0500)]
Fix: directory-handle: use of free'd handle on fstat() error
On an error to fstat a directory handle, a directory handle is
released and is still initialized as if the error had not occurred.
Return NULL early from lttng_directory_handle_create_from_dirfd()
to prevent those erroneous accesses.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia2a3bb1cfe8c90d3f7f87a68286a9b8524694d3c
Jérémie Galarneau [Tue, 18 Feb 2020 01:05:22 +0000 (20:05 -0500)]
Fix: relayd: use of relay_session ref count before initialization
The relay_session's reference count is used before it is initialized
on multiple code paths of session_create(). The initialization of the
reference count, mutexes, and intrusive data structure nodes are
initialized earlier to make their use safe in the event of an error.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1be53ad88a3e783b85b4c568527df1a75ce58d3a
Jérémie Galarneau [Tue, 18 Feb 2020 00:32:54 +0000 (19:32 -0500)]
Fix: relayd: unchecked return value when opening relay socket
fd_tracker_open_unsuspendable_fd may fail because the underlying
socket() call fails or there may be too many open file descriptors at
the time of the call. In both cases, these errors must be logged and
handled.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8b8c4fcc9de08746a91778b58c74b2118e98667b
Simon Marchi [Tue, 11 Feb 2020 22:29:09 +0000 (17:29 -0500)]
configure: add --enable-Werror
If one wants to build with -Werror, it's not possible to simply
configure with -Werror in the CFLAGS. This makes a bunch of configure
checks fail, which would have otherwise passed.
This patch adds an --enable-Werror option to configure, which has the
effect of adding -Werror to AM_CFLAGS. It therefore ends up in the
CFLAGS used to build the project, but it doesn't interfere with the
configure checks.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I18c33125c717305aac8f1d8a19fee7e065d70c31
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Fri, 31 Jan 2020 18:05:20 +0000 (13:05 -0500)]
configure: use AX_APPEND_COMPILE_FLAGS to detect supported warning flags
I would eventually like to enable some additional warnings by default
when building lttng-tools. However, some warnings are
compiler-specific or are not present in older versions of some compilers
we need to support. We can therefore not add them unconditionally to
CFLAGS.
This patch uses the AX_APPEND_COMPILE_FLAGS macro to address that. This
macro tests each individual flag we pass it with the current compiler.
If it finds that the flag is supported (the compiler exits with status 0
when compiling a file with that flag), it appends it to the given
variable, WARN_CFLAGS in our case). WARN_CFLAGS is then added to
AM_CFLAGS.
With time, we'll be able to throw any warning flag in there that we
think is useful, even if just available in a recent version of one
compiler.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Id2ae4b4e8882af788c835ce89a979544531370e9
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 3 Feb 2020 22:38:23 +0000 (17:38 -0500)]
tests: append to AM_CFLAGS instead of overriding it
The Makefiles modified by this patch currently override the AM_CFLAGS
value, which means that anything put in AM_CFLAGS by configure (for
example, the warning flags) is lost.
I believe the intention is to add some flags to CFLAGS, so modify them
such that they append instead of override.
notification/Makefile.am overrides AM_LDFLAGS with nothing. It feels
like it was not the intention to actually clear that variable, but
rather that it is just the by-product of a copy paste. If it was really
the intention to clear the value of AM_LDFLAGS, there would have been a
comment to explain it, right?
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I4ef926d9135b16200e5f17d09461506a5e955068
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Wed, 12 Feb 2020 00:27:05 +0000 (19:27 -0500)]
Tests: gen-ust-nevents: use options instead of arguments
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I59c648c650304e12b30bf8a3eaedaf9727c48700
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Wed, 12 Feb 2020 00:17:36 +0000 (19:17 -0500)]
Tests: Cleanup: test_exclusion: more detailed output
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I97baaf30385b644766f2e825d8884ea75770b330
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Tue, 11 Feb 2020 23:27:35 +0000 (18:27 -0500)]
Fix: Tests: `test_exclusion` passing for the wrong reason
Issue
=====
The following commit added `-i` and `-w` flags to the test app arguments
of the `test_exclusion` tests:
commit
6c4a91d639747f260ab46decebc50998ef063712
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: Mon Aug 26 14:22:06 2019 -0400
tests: gen-ust-events: use options instead of arguments
Remove argument dependency and ease usage of features individually.
The `gen-ust-nevents` was not modified to support those flags. I suspect this
mistake was caused by the name similarity of the `gen-ust-nevents` and the
`gen-ust-events` test applications.
We ended up calling the following command:
./gen-ust-nevents -i 100 -w -1
When called with such arguments the `gen-ust-nevents` parsed the first
argument (`-i`) using `atoi()` which retuned 0. This was interpreted as
the number of iterations requested by the user so the app immediately
exited without generating any events.
So, the test was not seeing any of the excluded events in the trace
which was then considered as a successful result but no events were ever
excluded because none were generated in the first place.
Solution
========
Remove the use of `-i` and `-w` flags.
I also added a `dry_run` test to confirm that we do indeed get events
when exclusions are not used to prevent this error from happening in the
future.
Notes
=====
- I changed the wildcard used in the enable-event command so to only
enable events from the testapp and not the `lttng_ust_statedump:` events
as those are generated even if we didnt' ask for them.
- I add a stderr redirection to `/dev/null` in the trace reading
pipeline because we now end up with traces with no events. This has
changed because we now only enable events from the application (see
previous note).
- In a future commit, I will change the `gen-ust-nevents` application to
take those `-i` and `-w` flags.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Id37dcd59a18b3401d97439bce1191a8c5cac87d5
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Tue, 11 Feb 2020 20:51:52 +0000 (15:51 -0500)]
Tests: notification.c: remove extra space
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Iee893ab9d4aeb59e335af83b068adf716ac869f8
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 18 Feb 2020 00:51:54 +0000 (19:51 -0500)]
Fix: trace-chunk: useless assignment to 'ret'
'ret' is not used to report error in
lttng_trace_chunk_rename_path_no_lock(); status is used. Therefore,
this assignment is useless.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1804d616a24c41d3956b021f90bb77d0e6efef1a
Jérémie Galarneau [Tue, 18 Feb 2020 00:49:04 +0000 (19:49 -0500)]
Fix: lttng: track-untrack: error assigned to wrong variable
CMD_ERROR is assigned to 'ret' rather than 'command_ret' when
an unknown left-over argument is passed to the track/untrack
command.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I5889a934d9859d0499eb26555658bf15af73f927
Jérémie Galarneau [Tue, 18 Feb 2020 00:46:18 +0000 (19:46 -0500)]
Fix: relayd: live: unchecked poll set creation return value
The fd_tracker_util_poll_create function can fail because of fd
exhaustion or because the underlying epoll call fails.
In both cases, report and handle the error.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie79fdc011afda43395ac883c6648f983118cfddb
Jérémie Galarneau [Tue, 18 Feb 2020 00:40:47 +0000 (19:40 -0500)]
Fix: relayd: live: unchecked return value when opening relay socket
fd_tracker_open_unsuspendable_fd may fail because the underlying
socket() call fails or there may be too many open file descriptors at
the time of the call. In both cases, these errors must be logged and
handled.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3205896a5e8c83ceba02005a2b73f9466d26427c
Jérémie Galarneau [Tue, 18 Feb 2020 00:35:52 +0000 (19:35 -0500)]
Fix: relayd: unchecked poll set creation return value
The fd_tracker_util_poll_create function can fail because of fd
exhaustion or because the underlying epoll call fails.
In both cases, report and handle the error.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id1e35d43442e74dd6784a9a4e235576a5bf135e2
Jérémie Galarneau [Fri, 14 Feb 2020 22:09:58 +0000 (17:09 -0500)]
Fix: lttng: uninitialized pointer free'd when no sessiond is present
The error path of get_schedules assumes that schedules_comm is !NULL,
which is not the case currently.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I16e2d9d45cd3df9cfa80214abe03bcc782fa1f11
Jérémie Galarneau [Wed, 12 Feb 2020 23:52:41 +0000 (18:52 -0500)]
Fix: tracker: inclusion of internal header in public header
common/macros.h is an internal header which should not be used
publicly. It doesn't seem used anyhow so it is simply removed here.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie385dba2dc03506db2e075c15969836303470b56
Francis Deslauriers [Tue, 11 Feb 2020 02:46:34 +0000 (21:46 -0500)]
Tests: Fix: `wait_on_file()` returns too early
Issue
=====
With the current implementation, when calling the `wait_on_file()`
function with the `file_exist` parameter set to false the function will
return even if the target file exists.
In a scenario where we enter the loop and the targer file exist, the
first call to `stat()` will return 0 and will not enter any of the `if`
and break from the loop directly.
Solution
========
If the file exists, only break from the loop if it's the desired exit
condition.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ia3e9c41a2a515815d3ff931d8f7c1c14a52b31ae
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Fri, 7 Feb 2020 19:56:50 +0000 (14:56 -0500)]
Fix: Tests: utils.sh: fix unbound variable
When loading `utils.sh`, we test the `LTTNG_TEST_TEARDOWN_TIMEOUT` and
define it to a default value if it's not defined already.
When running bash test scripts with the `-u` option to error out when
encountering unset variables it prints an error and exit
This commit uses a trick found here:
https://stackoverflow.com/questions/
3601515/how-to-check-if-a-variable-is-set-in-bash
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Id24937f974ffd1ab3250296499da9360f97d393d
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 10 Feb 2020 22:18:48 +0000 (17:18 -0500)]
Tests: Fix typo: registerd -> registered
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I74f6956d732c41168dfdfa101c6fcad0af6ecebe
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 10 Feb 2020 22:43:21 +0000 (17:43 -0500)]
Tests: Cleanup: remove unused bash variable
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ie200a8b5044e2199526aac4a138f0c2e5ee5b0d8
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Thu, 6 Feb 2020 15:26:05 +0000 (10:26 -0500)]
Typo: 'toogle' -> 'toggle'
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Id3c9a1942b21a66b626512e8378c517d48949582
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Wed, 5 Feb 2020 16:41:23 +0000 (11:41 -0500)]
Fix: lttng-sessiond: control reaches end of non-void function warning
Fixes the following error when building with GCC 7.4.0 with the
following CFLAGS: "-g -fsanitize=address":
tracker.c: In function ‘lttng_tracker_id_lookup_string’:
tracker.c:405:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
At first glance, this seems like a false positive. I don't see how we
can reach the end of the function without passing by a return statement.
Even considering that, removing the `break` statement makes sense
because it's superfluous.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I0b596d328bc38183f21bd3a6f8419a63207953f3
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 4 Feb 2020 21:03:00 +0000 (16:03 -0500)]
Fix: possible null dereference
lttng_inode_create can return null.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I70be9ebabe097d10fb3ee5f46f0b299c02d08ce0
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 4 Feb 2020 21:03:40 +0000 (16:03 -0500)]
Fix: string might be uninitialized
lttng_dynamic_appen_buffer accepts NULL buf as long as len is zero when
called. This is the case for when the id is a numeric value.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: Ia1a121dcc2448378a4ad873ac159a89221e4c637
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 4 Feb 2020 21:04:41 +0000 (16:04 -0500)]
Fix: force the use of our _FORTIFY_SOURCE definition
Some toolset (ubuntu) already defined the _FORTIFY_SOURCE.
This removes the warning we see if this is the case. Unset the variable and
reset it.
The warning:
make[3]: Entering directory '/home/joraj/lttng/master/lttng-tools/tests/regression/kernel'
CC select_poll_epoll-select_poll_epoll.o
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<built-in>: note: this is the location of the previous definition
CCLD select_poll_epoll
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I2fa0482afa8941705a992f62a2e63657ea9e2b87
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 4 Feb 2020 19:59:41 +0000 (14:59 -0500)]
Update version to v2.12.0-rc1
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6845405f0d59270181ab67f27f8acab5d83633d7
Jérémie Galarneau [Tue, 4 Feb 2020 00:51:08 +0000 (19:51 -0500)]
Tests: fix: test_relayd_working_directory fails as user
A formating issue introduced by
15da468cd causes the temporary
directory of the a test to be initialized incorrectly, causing it to
fail when it is not skipped (executed as a non-root user).
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Idd09f27fa2ce0f5991056ab52bc1718080122151
Jérémie Galarneau [Mon, 3 Feb 2020 22:33:28 +0000 (17:33 -0500)]
Fix: sessiond: snapshot errors don't clear session's trace chunk
The snapshot record command is implemented by creating and setting
a new trace chunk on the target session, capturing the snapshot, and
closing the session's trace chunk once it is complete.
On some error paths, the session's newly created trace chunk is not
cleared. This means that the session is seen to have a
'current_trace_chunk' on the next attempt to record a snapshot; an
unexpected condition for which an assert() exists.
This results in the following crash:
lttng-sessiond: /home/smarchi/src/lttng-tools/src/bin/lttng-sessiond/cmd.c:4685: snapshot_record: Assertion `!session->current_trace_chunk' failed.
Ensure that the session's current trace chunk is closed and cleared
when an error occurs during the command's execution.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4f78e3c324bee873349ed5b4d8e189a000458a07
Jérémie Galarneau [Mon, 3 Feb 2020 22:25:58 +0000 (17:25 -0500)]
Fix: sessiond: bounded snapshot record fails when no streams exist
Attempting to record a snapshot with a `--max-size` fails when no
streams exist. For instance, attempting to record a snapshot for a
user space session when no applications are running will fail with the
following output:
Error: Invalid snapshot size. Cannot fit at least one packet per stream.
Error: Snapshot max size is invalid
The function get_session_nb_packets_per_stream() computes an
approximation of the number of packets to capture to honor the maximal
size specified. However, at the end, it doesn't distinguish between
'0' meaning that "no packets can be captured" (no streams exist) and
'0' meaning that "the max size is too small to accomodate one packet".
Those two cases can be distinguished by checking if the 'size_left' is
still the 'max_size', meaning that not even the size of one packet was
substracted from 'max_size'.
Reported-by: Simon Marchi <simark@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I5caef9ce926bbc7143a90667749ffaed972590c1
Jérémie Galarneau [Mon, 3 Feb 2020 20:56:43 +0000 (15:56 -0500)]
Tests: fix: test_relayd_working_directory fails as root
From the original bug report:
This test succeeds as user, but fails as root:
not ok 23 - Warning about missing write permission is present
Failed test 'Warning about missing write permission is present'
in tools/working-directory/test_relayd_working_directory:test_relayd_debug_permission() at line 182.
The warning does not trigger because root always has access.
Skip this test since the permission check will succeed and the relay
daemon won't produce the expected error message.
Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4eb29958aaca78405e1fdd2392d73472af0d5912
Jérémie Galarneau [Mon, 3 Feb 2020 19:34:53 +0000 (14:34 -0500)]
Fix: trace-chunk: dereference after NULL check
old_path is used directly even though it is checked for NULL. The
situation highlighted by Coverity does not appear to be possible given
the current use of the API. However, it should still be checked to
catch future errors (or current bugs).
1412200 Dereference after null check
Either the check against null is unnecessary, or there may be a null
pointer dereference.
In lttng_trace_chunk_rename_path_no_lock: Pointer is checked against
null but then dereferenced anyway (CWE-476)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I991231cc636eaed98cb84eec08a5072748ff9ef4
Jérémie Galarneau [Fri, 31 Jan 2020 23:22:22 +0000 (18:22 -0500)]
Clean-up: mi: remove logically dead code
1412199 Logically dead code
The indicated dead code may have performed some action; that action
will never occur.
In mi_lttng_id_target: Code can never be reached because of a logical
contradiction (CWE-561)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8279cd1e6ab5bc86bd4ea4ca8ac721ad1e31e02b
Jérémie Galarneau [Fri, 31 Jan 2020 23:20:18 +0000 (18:20 -0500)]
Fix: trace-chunk: dereference after null check of old_path
1412200 Dereference after null check
Either the check against null is unnecessary, or there may be a null
pointer dereference.
In lttng_trace_chunk_rename_path_no_lock: Pointer is checked against
null but then dereferenced anyway (CWE-476)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I33088fecc62141bd6092a7ab8c0a8c29a36347e8
Jérémie Galarneau [Fri, 31 Jan 2020 23:06:09 +0000 (18:06 -0500)]
Clean-up: unchecked return value
The return value of lttng_dynamic_buffer_set_size() is ignored in
lttng_dynamic_array_clear(). It is okay as
lttng_dynamic_buffer_set_size(..., 0) can't fail. However, it
results in a Coverity Scan warning.
1412201 Unchecked return value
If the function returns an error value, the error value may be
mistaken for a normal value.
In lttng_dynamic_array_clear: Value returned from a function is not
checked for errors before being used (CWE-252)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1943e299e4cb5752711f2d25b0dd9a5c44a28a18
Jérémie Galarneau [Fri, 31 Jan 2020 23:04:49 +0000 (18:04 -0500)]
Fix: unchecked return value of cds_lfht_destroy()
1412202 Unchecked return value
If the function returns an error value, the error value may be
mistaken for a normal value.
In lttng_tracker_list_destroy: Value returned from a function is not
checked for errors before being used (CWE-252)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I85c994440bc2cd5df0545fd1364dab462f98bc1c
Jérémie Galarneau [Fri, 31 Jan 2020 22:58:56 +0000 (17:58 -0500)]
Fix: relayd: return from function without unlocking session lock
Some error paths in relay_close_trace_chunk() skip the unlock
of the relay_session's lock.
412203 Missing unlock
May result in deadlock if there is another attempt to acquire the
lock.
In relay_close_trace_chunk: Missing a release of a lock on a
path (CWE-667)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I43187959abf00e761f7a255f4af7cd53e0c451fb
Jérémie Galarneau [Fri, 31 Jan 2020 22:56:26 +0000 (17:56 -0500)]
Clean-up: consumerd: remove unreachable code
1412204 Logically dead code
The indicated dead code may have performed some action; that action
will never occur.
In consumer_clear_unmonitored_channel: Code can never be reached
because of a logical contradiction (CWE-561)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I116ba5127bf30d3cee1e5f002d7360bc4bc22098
Jérémie Galarneau [Fri, 31 Jan 2020 22:51:04 +0000 (17:51 -0500)]
Clean-up: trace-chunk: remove unreachable code
`path` can never be NULL in this code path; it is unnecessary to check
it.
There may be a null pointer dereference, or else the comparison
against null is unnecessary.
In lttng_trace_chunk_rename_path_no_lock: All paths that lead to this
null pointer comparison already dereference the pointer
earlier (CWE-476).
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4d850b0b8686300268d85f577ae5f14a96d66348
Jérémie Galarneau [Fri, 31 Jan 2020 22:41:08 +0000 (17:41 -0500)]
Fix: unchecked return value of lttng_directory_handle_create()
Although unlikely in this case (as the path was just created), the
creation of a directory handle can fail and this should always be
accounted-for.
1415129 Dereference null return value
If the function actually returns a null value, a null pointer
dereference will occur.
In lttng_unlinked_file_pool_add_inode: Return value of function which
returns null is dereferenced without checking (CWE-476)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I914802c25b569320e08265aae251e062bccbd50e
Jérémie Galarneau [Fri, 31 Jan 2020 22:38:23 +0000 (17:38 -0500)]
Tests: fd-tracker: fix: leak of test paths
Leak of memory or pointers to system resources (CWE-404)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id57254c990ee43dc6901c7778655830e0564e975
Simon Marchi [Fri, 31 Jan 2020 19:22:24 +0000 (14:22 -0500)]
session-descriptor: fix comment typos in session-descriptor.h
Change-Id: Idafd16fd2851798a47bd95a7887f5bf9ba7828d0
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 31 Jan 2020 21:48:20 +0000 (16:48 -0500)]
Fix: directory-handle: typo in equals method breaks compat build
The 'path' member does not exist in a directory handle; 'base_path'
should be used instead. This breaks the build on platforms that
lack dirfd support (e.g. Solaris 10).
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1cedf36520960c575b470d4306755dfeb9417cb4
Jérémie Galarneau [Fri, 31 Jan 2020 21:33:26 +0000 (16:33 -0500)]
Fix: potential use of uninitialized return value
lttng_tracker_ids_serialize() can return an uninitialized value
when 0 ids are being tracked by a tracker. This is not currently
reachable, but generates a warning on some compilers.
'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia54f5276d6a89d39badfc6c718ad0032edb98ec8
Jérémie Galarneau [Fri, 31 Jan 2020 21:25:14 +0000 (16:25 -0500)]
Clean-up: remove instances of loop initial declarations
Loop initial declarations are not permitted by the project's
coding standard and cause the build to fail on Solaris platforms.
tracker.c: In function 'lttng_tracker_ids_serialize':
tracker.c:314:2: error: 'for' loop initial declarations are only allowed in C99 mode
for (unsigned int i = 0; i < count; i++) {
^
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I627974ef82ca26586c96d354f217f9943db9d67c
Jérémie Galarneau [Fri, 31 Jan 2020 21:12:24 +0000 (16:12 -0500)]
Fix: relayd: register listener threads as rcu readers
Both live and consumer listener threads are now RCU readers as
they use the fd_tracker which makes use of RCU.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8aab8615b8db1f1fea48deb1ae03ad5beeaa6f32
Jérémie Galarneau [Thu, 30 Jan 2020 16:45:07 +0000 (11:45 -0500)]
relayd: track directory handles through the fd-tracker
Track directory handles through the fd-tracker as unsuspendable
file descriptors. New fd-tracker utils are introduced to wrap
the creation and registration of the file descriptors to the
fd-tracker.
Note that file descriptors only need to be tracked when the
dirfd-backed implementation of the directory handles is used.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I754af1943f5d6f02a6219d48c8fc4b8106de1c13
Michael Jeanson [Thu, 7 Mar 2019 19:54:57 +0000 (14:54 -0500)]
tests: Move to kernel style SPDX license identifiers
The SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.
See https://spdx.org/ids-how for details.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I89cd4b4b7440f71f52426a5508252932bb46e796
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Wed, 15 Jan 2020 20:42:31 +0000 (15:42 -0500)]
Fix: include stdlib.h in compat/string.h
Fixes:
CC uuid.lo
In file included from /home/smarchi/src/lttng-tools/src/common/uuid.c:19:0:
/home/smarchi/src/lttng-tools/src/common/compat/string.h: In function ‘lttng_strndup’:
/home/smarchi/src/lttng-tools/src/common/compat/string.h:78:8: error: implicit declaration of function ‘malloc’ [-Werror=implicit-function-declaration]
ret = malloc(navail);
^~~~~~
/home/smarchi/src/lttng-tools/src/common/compat/string.h:78:8: error: incompatible implicit declaration of built-in function ‘malloc’ [-Werror]
/home/smarchi/src/lttng-tools/src/common/compat/string.h:78:8: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
Note that this is in fallback code when the system doesn't provide
strndup (or, in my case, the system provides it but configure failed to
find it).
Change-Id: I5817b0b2436573b7d8fecb2956577a7b183d6296
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 30 Jan 2020 21:12:35 +0000 (16:12 -0500)]
Cleanup: remove superfluous tests.txt
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I0f9a505c5e9c22fbcebe534b9750d25645813174
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 30 Jan 2020 23:33:57 +0000 (18:33 -0500)]
fix: add include guards to compat/path.h
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Ifb0672dcaf9b98715742546d71e54c5f4cd8dff6
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 7 Mar 2019 19:53:45 +0000 (14:53 -0500)]
Move to kernel style SPDX license identifiers
The SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.
See https://spdx.org/ids-how for details.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I62e7038e191a061286abcef5550b58f5ee67149d
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Sun, 26 Jan 2020 22:21:33 +0000 (17:21 -0500)]
Sync ax_have_epoll.m4 with autoconf-archive
This updates gets rid of an unused variable warning at configure time,
so removes one hurdle to configure with CFLAGS="-Werror".
Change-Id: I7adfed3f821409d7ea36c79e19e96b1977e32804
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 21 Jan 2020 23:27:53 +0000 (18:27 -0500)]
.gitignore: ignore gen-kernel-test-events
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I668b8f9ed7066a1e10ec542773b7ab346d9c8710
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Fri, 17 Jan 2020 20:09:21 +0000 (15:09 -0500)]
Fix: lttng: sanity check of `--probe` description
Issue
=====
Run the following command:
lttng enable-event -k --probe "\do_fork" my_do_fork_event
currently fails and that is expected.
But it does not fail for the right reason. In the `parse_probe_opts()`
function, during the last step of parsing the probe description we assume
it's a raw address and pass the string directly to the `strtoul()`
function. So if the probe description is not an address at all (e.g.
"\do_fork"), the `strtoul()` call will return 0 in the `addr` field of
the probe struct. This is then passed to the kernel tracer that asks the
kernel to instrument that address with a kprobe. This fails because 0x0
is not an address that can be instrumented.
Solution
========
Check that the first character of the tentative address is a digit
before trying to convert the string to an integer. This is not perfect
but at least it prevents some errors.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I444f0e7694098b1cdb56ecbf5d92be8974e406dc
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 30 Jan 2020 17:40:08 +0000 (12:40 -0500)]
lttng-view: make babeltrace2 the default viewer
Use the `babeltrace2` binary to view traces by default rather than
the legacy `babeltrace`. As the install base of Babeltrace 2.x is
rather small at this point, silently fallback to Babeltrace 1.x
when it is not found on the system.
The man page is updated to reflect this change in behaviour.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie7cd7424f8af1e25238fcc4bb1aa3ee8226da023
Jérémie Galarneau [Thu, 30 Jan 2020 17:12:45 +0000 (12:12 -0500)]
lttng-view: clean-up: remove unneeded empty line
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I358abf4e41ac248a4c422772ebdfc4ffdc7fe196
Jérémie Galarneau [Thu, 30 Jan 2020 17:10:18 +0000 (12:10 -0500)]
lttng-view: clean-up: static struct viewers array should be const
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I538bebf471eb15202908c27ab108e27f7f990103
Jérémie Galarneau [Thu, 30 Jan 2020 17:01:57 +0000 (12:01 -0500)]
lttng-view: clean-up: remove commented and unused references to lttv
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I207c1a00c37b61bd7bd76a265e17e1e4bdf53d93
Jérémie Galarneau [Thu, 30 Jan 2020 06:51:10 +0000 (01:51 -0500)]
relayd: register fd tracker instance to all created trace chunks
Provide a reference to 'the_fd_tracker' to trace chunks during their
creation. This causes file descriptors created through the relay
daemon's trace chunks to be tracked by the daemon's fd tracker.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9c96851ef06bb7f0be0c7f3e8b7f01638f13fbda
Jérémie Galarneau [Thu, 28 Jun 2018 05:16:56 +0000 (01:16 -0400)]
relayd: track relayd control connection sockets
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If5b0f85aac48bb04a08c95b76398b8f1b2ad98d8
Jérémie Galarneau [Thu, 28 Jun 2018 05:16:43 +0000 (01:16 -0400)]
relayd: track relayd data connection sockets
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I510f2ca49995e56735408d14562cf1d45fef842e
Jérémie Galarneau [Thu, 30 Jan 2020 06:27:16 +0000 (01:27 -0500)]
relayd: replace uses of block FDs by the fs_handle interface
Replace all usage of "raw" block-device file descriptors for
relay_streams, viewer_streams, and index files by the fs_handle.
Wrappers are introduced for read, write, seek and truncate operations
in order to reduce code duplication as all uses of fs_handles implies
getting an fd, using it, and putting it back. Those operations allow
the fd-tracker to suspend and restore fs_handles as needed.
The stream_fd util is eliminated as it is completely replaced by
the fs_handle interface.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iedff88d27aeba3891d4e8818b9e08e4b16a927cc
Jérémie Galarneau [Wed, 29 Jan 2020 04:53:49 +0000 (23:53 -0500)]
fd-tracker: restore suspended handles from their inode's path
In order to support session rotations and, to a lesser degree, the
"clear" command, the fd-tracker internals (lttng_inode and fs_handle)
need to recover from files being renamed while the handle to it is
suspended.
This refactor introduces a "location" to the lttng_inode which is
updated anytime an unlink or rename is performed on an fs_handle.
Keep in mind that multiple independent fs_handles can refer to the
same lttng_inode (a unique tuple of device id and inode number).
This location is used to restore the fs_handle whenever it is needed.
Moreover, since the session rotation/clear operations sometimes rely
on directories having been emptied after rename/unlink, the current
scheme of renaming unlinked files to the form
"filename-deleted-suffix" no longer works.
The renaming scheme is replaced by a new "unlinked file pool", which
is an hidden directory at the base of the output directory which
contains the files which were unlinked to which
references (fs_handles) are still being held. The API of the
fd-tracker itself had to be changed slightly and the tests are adapted
as a consequence. New tests targeting this new behaviour are also
added.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9b1344da1966c85bdd6b51838507d3208e1d9a42
Jérémie Galarneau [Wed, 29 Jan 2020 04:39:01 +0000 (23:39 -0500)]
directory-handle: query if instance is backed by a file descriptor
Allow a user of a directory handle to know if a given instance is
backed by a file descriptor. This is needed to ensure the fd-tracker
can accurately track the number of file descriptors in use at a given
moment.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I64aeeae2623a35ed07964432bb18b16aeeeb89ec
This page took 0.050941 seconds and 4 git commands to generate.