SoW-2019-0002: Dynamic Snapshot Revision 2
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
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
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
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>
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>
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>
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>
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>
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
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
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
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
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
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
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
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>
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>