lttng-ust.git
9 years agoFix: use lttng_secure_getenv to handle env. vars. involving paths
Mathieu Desnoyers [Thu, 23 Apr 2015 22:45:05 +0000 (18:45 -0400)] 
Fix: use lttng_secure_getenv to handle env. vars. involving paths

This is a security fix for applications linked against liblttng-ust
which are exposed as setuid binaries.

A malicious user which can run those applications could target those
environment variable paths to locations that would allow it to create
files in various areas of the filesystem.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add missing getenv wrapper
Mathieu Desnoyers [Thu, 23 Apr 2015 22:48:43 +0000 (18:48 -0400)] 
Fix: add missing getenv wrapper

Required for old glibc.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Don't wait during registration if clock_gettime() fails
Jérémie Galarneau [Thu, 23 Apr 2015 17:07:38 +0000 (13:07 -0400)] 
Fix: Don't wait during registration if clock_gettime() fails

get_constructor_timeout() currently returns -1 which, according to
the lttng-ust(3) man page and lttng_ust_init() implementation,
"waits forever".

This changes the behavior to match what is expressed in the comments.

Comments in get_constructor_timeout() and get_timeout() are also
modified to match the following convention:

-1: wait forever
0: don't wait
1: wait for "constructor_delay_ms"

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoVersion 2.5.3 v2.5.3
Mathieu Desnoyers [Mon, 26 Jan 2015 20:07:27 +0000 (15:07 -0500)] 
Version 2.5.3

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: missing parenthesis in offset_align_floor
Mathieu Desnoyers [Fri, 16 Jan 2015 16:33:00 +0000 (11:33 -0500)] 
Fix: missing parenthesis in offset_align_floor

Is currently unused. Triggers a compile error when used.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add urcu-bp TLS fixup
Mathieu Desnoyers [Mon, 12 Jan 2015 18:27:53 +0000 (13:27 -0500)] 
Fix: add urcu-bp TLS fixup

When performing a library base address statedump, the UST threads can
grab the RCU read-side lock, which touch a TLS. We should "pre-fault"
this TLS in the constructor to eliminate a deadlock involving libc
dynamic loader lock.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add missing poll.h include
Mathieu Desnoyers [Mon, 12 Jan 2015 16:09:18 +0000 (11:09 -0500)] 
Fix: add missing poll.h include

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: get_subbuf: bound number of consumerd retry
Mathieu Desnoyers [Mon, 5 Jan 2015 02:06:19 +0000 (21:06 -0500)] 
Fix: get_subbuf: bound number of consumerd retry

When an application traced with per-UID buffers vanishes between its
reserve and commit ring buffer operations (e.g. segfault), it may cause
the consumer daemon to enter an endless loop, awaiting for the
application to complete its commit.

Fix this situation by bounding the number of retry using an adaptative
approach: try actively for a few times, and then try a few more times
with a 10ms delay between attempts.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoVersion 2.5.2 v2.5.2
Mathieu Desnoyers [Fri, 12 Dec 2014 17:14:40 +0000 (12:14 -0500)] 
Version 2.5.2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: man: you can't link a lib with a static lib
Philippe Proulx [Wed, 26 Nov 2014 21:50:56 +0000 (16:50 -0500)] 
Fix: man: you can't link a lib with a static lib

Fixes: #825
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: context alignment not properly handled
Mathieu Desnoyers [Mon, 1 Dec 2014 23:18:13 +0000 (18:18 -0500)] 
Fix: context alignment not properly handled

This issue affects only architectures without efficient unaligned
accesses, only when a context field with larger alignment follows a
context field with smaller alignment. It generates unreadable traces
when such context fields are enabled in this configuration.

Fixes #867

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Shorthand option -cp not supported in all version of Java
Christian Babeux [Fri, 28 Nov 2014 21:39:50 +0000 (16:39 -0500)] 
Fix: Shorthand option -cp not supported in all version of Java

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: allow tracepoints to build with --std=c99
Mathieu Desnoyers [Mon, 17 Nov 2014 16:36:10 +0000 (17:36 +0100)] 
Fix: allow tracepoints to build with --std=c99

std=c99 without #define __USE_BSD does not work for tracepoint header,
due to missing endianness macros. Force their definition in the
ust-endian.h wrapper if they are missing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: filter attach vs event enable race
Mathieu Desnoyers [Wed, 12 Nov 2014 23:08:04 +0000 (18:08 -0500)] 
Fix: filter attach vs event enable race

In order to correctly handle the use-case where events are enabled
_after_ trace is started, and _after_ applications are already being
traced, the event should be created in a "disabled" state, so that it
does not trace events until its filter is attached.

This fix needs to be done both in lttng-tools and lttng-ust. In order to
keep ABI compatibility between tools and ust within a stable release
cycle, we introduce a new "disabled" within struct lttng_ust_event
padding (previously zeroed). Newer LTTng-UST checks this flag, and
fallback on the old racy behavior (enabling the event on creation) if it
is unset.

Therefore, old session daemon works with newer lttng-ust of the same
stable release, and vice-versa. However, building lttng-tools requires
an upgraded lttng-ust, which contains the communication protocol with
the new "disabled" field.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: add a configure check for weak symbols support
Christian Babeux [Wed, 12 Nov 2014 19:35:21 +0000 (14:35 -0500)] 
Fix: add a configure check for weak symbols support

Fixes #236

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix coverity warning about sizeof(void **) != sizeof(void *)
Mathieu Desnoyers [Wed, 12 Nov 2014 21:05:36 +0000 (16:05 -0500)] 
Fix coverity warning about sizeof(void **) != sizeof(void *)

The size of the copied data is actually void *, not void **.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: off-by-one in sequence filter comparator
Mathieu Desnoyers [Sat, 8 Nov 2014 17:16:41 +0000 (12:16 -0500)] 
Fix: off-by-one in sequence filter comparator

If we pass the following sequence as event input:
- field name "seqfield2"
- seq. len.: 4
- sequence array: "testA" (5 characters),

The following filters do not have the intended effect:
* 'seqfield2=="testA"'
  - expected: no match.
  - actual behavior: match.

* 'seqfield2=="test"'
  - expected: match.
  - actual behavior: no match.

This is caused by an off-by-one in the comparison with sequence length
in the filter bytecode interpreter.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.5.1 v2.5.1
Mathieu Desnoyers [Mon, 20 Oct 2014 20:59:51 +0000 (16:59 -0400)] 
Version 2.5.1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: preserve example files' timestamps when copying
Jérémie Galarneau [Thu, 16 Oct 2014 13:45:19 +0000 (09:45 -0400)] 
Fix: preserve example files' timestamps when copying

This fixes an issue where examples were always being rebuilt
when performing an out of tree build since the examples were
being copied to the build directory with a timestamp more
recent than the already-built example objects.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoconfigure.ac: fix "missing jni.h" error message
Philippe Proulx [Tue, 2 Sep 2014 20:12:55 +0000 (16:12 -0400)] 
configure.ac: fix "missing jni.h" error message

DIR in --with-java-jdk=DIR must point to the JDK base
directory, not the actual JDK include directory.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.5.0 v2.5.0
Mathieu Desnoyers [Wed, 16 Jul 2014 22:18:11 +0000 (18:18 -0400)] 
Version 2.5.0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoMutex while updating statedump_pending is not needed
Mathieu Desnoyers [Wed, 16 Jul 2014 21:40:53 +0000 (17:40 -0400)] 
Mutex while updating statedump_pending is not needed

Take care of coverity warning ** CID 1226392:  Data race condition  (MISSING_LOCK)
/liblttng-ust/lttng-ust-comm.c: 1704 in lttng_ust_sockinfo_session_enabled()

It's not that the lock is missing, it's that we don't need to hold the
lock when doing the other modification.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoRevert "Turn base address dump into experimental feature"
Paul Woegerer [Mon, 14 Jul 2014 08:38:25 +0000 (10:38 +0200)] 
Revert "Turn base address dump into experimental feature"

This reverts commit b11abb674e50c67e3410ab2bd5d0a263e88b73ba.

Signed-off-by: Paul Woegerer <paul_woegerer@mentor.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: document ust_fork_mutex nesting
Mathieu Desnoyers [Wed, 16 Jul 2014 14:35:43 +0000 (10:35 -0400)] 
Fix: document ust_fork_mutex nesting

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoBugfix for #745 deadlock with baddr statedump+fork
Paul Woegerer [Mon, 14 Jul 2014 08:38:24 +0000 (10:38 +0200)] 
Bugfix for #745 deadlock with baddr statedump+fork

Fixes #745

Signed-off-by: Paul Woegerer <paul_woegerer@mentor.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoMove enablers syncing after the channel registration
Francis Deslauriers [Thu, 10 Jul 2014 22:22:14 +0000 (18:22 -0400)] 
Move enablers syncing after the channel registration

Fixes possible race condition where an event registration is received
before its channel registration by the consumer.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAdd lttng_ust_notrace to static inline functions
Paul Woegerer [Mon, 7 Jul 2014 14:04:21 +0000 (16:04 +0200)] 
Add lttng_ust_notrace to static inline functions

The static inline functions
__tracepoint_provider_mismatch_<TRACEPOINT_PROVIDER> and
__tracepoint_provider_check_<TRACEPOINT_PROVIDER> are missing the
lttng_ust_notrace attribute to prevent them from getting instrumented
with -finstrument-functions (if e.g. defined in CFLAGS). This patch is
adding the attribute to those functions.

Signed-off-by: Paul Woegerer <paul_woegerer@mentor.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agolttng ust: support ppc64le within configure
Michel Normand [Mon, 30 Jun 2014 16:12:19 +0000 (12:12 -0400)] 
lttng ust: support ppc64le within configure

Takes care of https://bugzilla.redhat.com/show_bug.cgi?id=1114691

Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.5.0-rc2 v2.5.0-rc2
Mathieu Desnoyers [Fri, 27 Jun 2014 14:07:32 +0000 (10:07 -0400)] 
Version 2.5.0-rc2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: lttng-ust-jul: set thread in daemon mode
David Goulet [Thu, 26 Jun 2014 19:07:54 +0000 (15:07 -0400)] 
Fix: lttng-ust-jul: set thread in daemon mode

This way, when the JVM stops the main thread, the agent's thread will be
automatically shutdown thus making the .dispose() call optional.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoJUL: use root logger to capture events
David Goulet [Wed, 18 Jun 2014 18:08:24 +0000 (14:08 -0400)] 
JUL: use root logger to capture events

The JUL agent now uses the root logger ("") to capture all events. This
allows us to remove the Timer thread and cleanup a huge portion of the
code base. It simplifies a great deal the internal structure of the
agent since we don't have to monitor the Logger object anymore.

Since tracepoint filtering is done in UST, we just the LTTng handler to
the root logger and send everything to UST.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Wrong configure check for UST perf event counters context support
Christian Babeux [Thu, 26 Jun 2014 15:42:28 +0000 (11:42 -0400)] 
Fix: Wrong configure check for UST perf event counters context support

When building on non-x86 platforms, the build errors out with the following:

  CC       lttng-context-perf-counters.lo
lttng-context-perf-counters.c:95:2: error: #error "Perf event counters are only supported on x86 so far."
lttng-context-perf-counters.c: In function 'read_perf_counter':
lttng-context-perf-counters.c:114:4: warning: implicit declaration of function 'rdpmc' [-Wimplicit-function-declaration]
make[2]: *** [lttng-context-perf-counters.lo] Error 1

The configure script checks for the presence of the "perf_event.h" header to enable support for
perf events counters. However, the current implementation is only available on x86,
hence the build fails on platform where the perf header is available.

Fix this issue by detecting the architecture we are currently building and wether
to enable or not the support for perf event counters context.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: multiple providers in same C file failure
Mathieu Desnoyers [Tue, 10 Jun 2014 16:17:08 +0000 (12:17 -0400)] 
Fix: multiple providers in same C file failure

If we have a C file in an application that is meant to contain both the
instrumentation and the provider, build fails if we have more than one
provider.

Fixed by putting back definitions to the state they were when defined by
tracepoint.h after a probe provider is created. This allows the next
tracepoint provider to define its tracepoints.

Fixes #805

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: header inclusion guard typo in lttng-ust-tracef-provider.h
Gerlando Falauto [Tue, 3 Jun 2014 08:01:58 +0000 (10:01 +0200)] 
Fix: header inclusion guard typo in lttng-ust-tracef-provider.h

Fix typo potentially allowing for multiple inclusions.

Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: 2.5.0-rc1 changelog has off-by-one date v2.5.0-rc1
Mathieu Desnoyers [Wed, 28 May 2014 14:24:08 +0000 (10:24 -0400)] 
Fix: 2.5.0-rc1 changelog has off-by-one date

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.5.0-rc1
Mathieu Desnoyers [Wed, 28 May 2014 14:18:27 +0000 (10:18 -0400)] 
Version 2.5.0-rc1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: out of tree build for lib Java and JUL
David Goulet [Tue, 27 May 2014 15:03:42 +0000 (11:03 -0400)] 
Fix: out of tree build for lib Java and JUL

Reported-by: Daniel Olivier <daniel.olivier@ericsson.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: default loglevel is DEBUG
Mathieu Desnoyers [Fri, 23 May 2014 14:28:41 +0000 (10:28 -0400)] 
Fix: default loglevel is DEBUG

Include "tracef" events when no explicit loglevel is specified. (for
usability)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: refuse overwrite mode buffers with less than two subbuffers
Mathieu Desnoyers [Fri, 23 May 2014 13:27:01 +0000 (09:27 -0400)] 
Fix: refuse overwrite mode buffers with less than two subbuffers

Fixes #793

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: tracef.h: add missing c++ guard
Mathieu Desnoyers [Tue, 13 May 2014 13:34:03 +0000 (09:34 -0400)] 
Fix: tracef.h: add missing c++ guard

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: remove JUL loglevel filtering from the agent
David Goulet [Wed, 7 May 2014 15:33:41 +0000 (11:33 -0400)] 
Fix: remove JUL loglevel filtering from the agent

The loglevel filtering is now done on the UST side setup by
liblttng-ctl. To achieve that, the agent has a new structure to support
two semantic concepts being a LTTng event and a JUL logger that have a
relation of N:1. This addition does not impact the current interfaces of
the agent.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: cleanup JUL agent state on sessiond disconnect
David Goulet [Tue, 6 May 2014 15:56:25 +0000 (11:56 -0400)] 
Fix: cleanup JUL agent state on sessiond disconnect

Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Move generated headers to the BUILT_SOURCES target
Jérémie Galarneau [Wed, 7 May 2014 15:41:46 +0000 (11:41 -0400)] 
Fix: Move generated headers to the BUILT_SOURCES target

This fixes the out of tree build when enabling Java support. The
problem in using an LTTngUst.c target is that automake will then
assume the file is generated and thus be found in the builddir.

Using the BUILT_SOURCES target will ensure the
org_lttng_ust_LTTngUst.h and org_lttng_ust_jul_LTTngUst.h headers
are generated before LTTngUst.c is compiled.

Tested-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: perf ust: check close return value
Mathieu Desnoyers [Wed, 30 Apr 2014 16:09:59 +0000 (18:09 +0200)] 
Fix: perf ust: check close return value

Fix coverity defect:
** CID 1208905:  Unchecked return value  (CHECKED_RETURN)
/liblttng-ust/lttng-context-perf-counters.c: 147 in setup_perf()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoCleanup: work-around missing inet.h struct mmsghdr fwd declaration
Mathieu Desnoyers [Wed, 30 Apr 2014 07:08:27 +0000 (09:08 +0200)] 
Cleanup: work-around missing inet.h struct mmsghdr fwd declaration

Removes build warning.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoImplement LTTng-UST perf counters support on x86
Mathieu Desnoyers [Fri, 7 Feb 2014 16:07:44 +0000 (11:07 -0500)] 
Implement LTTng-UST perf counters support on x86

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix linking failure when cross-compiling
Adrien Vergé [Fri, 25 Apr 2014 16:12:24 +0000 (12:12 -0400)] 
Fix linking failure when cross-compiling

Examples binaries in doc/examples require libs in liblttng-ust/.libs/,
and those libs require other libs in the same directory.  For instance
liblttng-ust.so uses liblttng-ust-tracepoint.so symbols, so the latter
is needed to properly link example programs.  Currently, ld is given
the lib dir only via -rpath (used for linking executables dependencies)
but not via -rpath-link (used for linking libs dependencies).

When compiling regularly, this does not seem to be a problem (maybe ld
is smart enough).  However when cross-compiling with the
arm-linux-gnueabihf toolchain, -rpath-link is needed otherwise linking
fails with:

arm-linux-gnueabihf/bin/ld: warning: liblttng-ust-tracepoint.so.0, needed by ../../../liblttng-ust/.libs//liblttng-ust.so, not found (try using -rpath or -rpath-link)

This patch adds -rpath-link to doc/examples/Makefile.am.

Signed-off-by: Adrien Vergé <adrienverge@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: disable liblttng-ust-dl if dlinfo is not available in C library
Romain Naour [Wed, 9 Apr 2014 21:55:07 +0000 (23:55 +0200)] 
Fix: disable liblttng-ust-dl if dlinfo is not available in C library

According to uClibc commit [1], dlinfo is not available in recent uClibc
(>0.9.33), but available in older version of uClibc (<=0.9.33) whith a
different prototype than glibc.

dlinfo used by liblttng-ust-dl require RTLD_DI_LINKMAP that is not
available in uClibc.

To be able to use LTTng UST with uClibc, we need to disable the Dynamic
Linker Tracing functionality [2] if RTLD_DI_LINKMAP is not detected.

[1] http://git.uclibc.org/uClibc/commit/?id=f3c9dc499c5c787ddd8c4320f2d44d2ae6e40c22
[2] http://lists.lttng.org/pipermail/lttng-dev/2014-February/022423.html

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: pass proper args when writing commit counter
Mathieu Desnoyers [Tue, 15 Apr 2014 17:05:34 +0000 (13:05 -0400)] 
Fix: pass proper args when writing commit counter

lib_ring_buffer_write_commit_counter()'s 'buf_offset' argument should
contain offset of beginning of area used by the record being comitted.

However, lib_ring_buffer_commit() passes ctx->buf_offset, that gets
advanced by lib_ring_buffer_write() and thus points to just-after-
end-of-record at lib_ring_buffer_commit() time. This causes
lib_ring_buffer_write_commit_counter() to return without changing
commit_hot[idx].seq, due to

    if (unlikely(subbuf_offset(offset - commit_count, chan)))
            return;

Since after-crash data extraction tool checks 'seq' field to find out
how much data is in buffer, this results into inavailability of
data from partially-filled subbuffer for after-crash analysis.

This patch modifies lib_ring_buffer_write_commit_counter() and all its
callers to pass and expect the end of the area. So code works as it
should, and complete information becomes visible in crash dump.

[ Fix ported from lttng-modules. Changelog inspired from Nikita
Yushchenko's original patch. ]

Fixes #785

Reported-by: Nikita Yushchenko <nyoushchenko@mvista.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: pad strings that are modified concurrently with tracing
Mathieu Desnoyers [Mon, 14 Apr 2014 14:58:52 +0000 (10:58 -0400)] 
Fix: pad strings that are modified concurrently with tracing

Fixes #734

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Use $AM_CC when it is defined instead of gcc in demo-tracef
Jérémie Galarneau [Tue, 8 Apr 2014 18:43:32 +0000 (14:43 -0400)] 
Fix: Use $AM_CC when it is defined instead of gcc in demo-tracef

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoRevert "Fix: disable liblttng-ust-dl if dlinfo is not available in C library"
Mathieu Desnoyers [Tue, 8 Apr 2014 18:29:29 +0000 (14:29 -0400)] 
Revert "Fix: disable liblttng-ust-dl if dlinfo is not available in C library"

This reverts commit 88a15b8f075177056017dbcc2e0c6d624805a34e.

It has been reported that this commit breaks the standard case.

Fixes: #778
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: .split() the CC environment variable in lttng-gen-tp
Jérémie Galarneau [Tue, 8 Apr 2014 15:28:23 +0000 (11:28 -0400)] 
Fix: .split() the CC environment variable in lttng-gen-tp

The CC variable might contain command line arguments which lttng-gen-tp
currently does not handle. This fix ensures that the arguments are
properly passed on to the compiler binary as if a normal Makefile
was used.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: disable liblttng-ust-dl if dlinfo is not available in C library
Romain Naour [Sun, 6 Apr 2014 21:02:41 +0000 (23:02 +0200)] 
Fix: disable liblttng-ust-dl if dlinfo is not available in C library

According to uClibc commit [1], dlinfo is not available.
To be able to use LTTng UST with uClibc, we need to disable
the Dynamic Linker Tracing functionality [2].

[1] http://git.uclibc.org/uClibc/commit/?id=f3c9dc499c5c787ddd8c4320f2d44d2ae6e40c22
[2] http://lists.lttng.org/pipermail/lttng-dev/2014-February/022423.html

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: python invocation through env
Jesper Derehag [Thu, 27 Mar 2014 07:57:06 +0000 (08:57 +0100)] 
Fix: python invocation through env

This modification calls the interpreter through env instead of
directly, which should be more portable for those distros which do not install
python into /usr/bin/.

Signed-off-by: Jesper Derehag <jderehag@hotmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoChange default loglevel to TRACE_DEBUG_LINE
Mathieu Desnoyers [Wed, 2 Apr 2014 20:02:37 +0000 (16:02 -0400)] 
Change default loglevel to TRACE_DEBUG_LINE

We do not want default loglevel to include tracef() debug output.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Override AM_PATH_PYTHON's default action-if-not-found
Jérémie Galarneau [Tue, 1 Apr 2014 15:49:58 +0000 (11:49 -0400)] 
Fix: Override AM_PATH_PYTHON's default action-if-not-found

AM_PATH_PYTHON's default action aborts configure. This fix ensures that
configure follows through with a noop.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: don't accept configure --disable-shared
Mathieu Desnoyers [Tue, 25 Mar 2014 14:00:28 +0000 (10:00 -0400)] 
Fix: don't accept configure --disable-shared

Building LTTng-UST with --disable-shared compiles fine, but the
resulting installed static libraries silently fails to trace, because
tracepoint fails to dlopen liblttng-ust-tracepoint.so. So don't allow
this unsupported configure option.

Also document this requirement in the README.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: configure.ac: add missing result to alignment req. check
Mathieu Desnoyers [Tue, 25 Mar 2014 13:46:40 +0000 (09:46 -0400)] 
Fix: configure.ac: add missing result to alignment req. check

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: malloc wrapper: infinite recursion with compat TLS
Mathieu Desnoyers [Tue, 18 Mar 2014 14:27:03 +0000 (10:27 -0400)] 
Fix: malloc wrapper: infinite recursion with compat TLS

Fixes #765

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: lttng-ust needs -ldl for tracef()
Mathieu Desnoyers [Sat, 15 Mar 2014 13:43:26 +0000 (09:43 -0400)] 
Fix: lttng-ust needs -ldl for tracef()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: typo in lttng-ust.3
Mathieu Desnoyers [Sat, 15 Mar 2014 13:36:01 +0000 (09:36 -0400)] 
Fix: typo in lttng-ust.3

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: liblttng-ust-libc-wrapper recursive use of calloc
Mathieu Desnoyers [Sat, 15 Mar 2014 00:31:13 +0000 (20:31 -0400)] 
Fix: liblttng-ust-libc-wrapper recursive use of calloc

When built with URCU with --disable-compiler-tls, URCU tls-compat.h uses
calloc in its TLS compat layer. This is used by RCU read-side, which is
used by tracepoint. So using a tracepoint in calloc triggers an infinite
recursion, since its first use of the TLS (with TLS compat) calls
calloc.

Fix this issue by keeping a per-thread nesting counter, and as soon as
we are allocating memory from a context nested within the memory
allocator, don't trace.

Don't trace from the static allocator: keep it as simple as possible,
since this is our fallback.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: add demo-tracef to dist tarball
Mathieu Desnoyers [Fri, 14 Mar 2014 22:24:16 +0000 (18:24 -0400)] 
Fix: add demo-tracef to dist tarball

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: add missing header files for tracef
Mathieu Desnoyers [Fri, 14 Mar 2014 21:34:41 +0000 (17:34 -0400)] 
Fix: add missing header files for tracef

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoImplement tracef() instrumentation API
Mathieu Desnoyers [Thu, 12 Dec 2013 12:29:26 +0000 (07:29 -0500)] 
Implement tracef() instrumentation API

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAdd 'unused' attribute to tracepoint callback
Zifei Tong [Fri, 14 Mar 2014 13:23:21 +0000 (21:23 +0800)] 
Add 'unused' attribute to tracepoint callback

Compiling tracepoint provider with clang generates 'Wunused-function'
warnings. Add 'unused' attribute to silence these warnings.

Fixes #760

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoUse autoconf AM_MAINTAINER_MODE
Lars Persson [Wed, 12 Mar 2014 09:28:49 +0000 (10:28 +0100)] 
Use autoconf AM_MAINTAINER_MODE

Give distribution maintainers the option to skip rebuilding
autoconf and automake generated files. The default behaviour
is still to have the rebuild rules enabled.

Signed-off-by: Lars Persson <larper@axis.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: mismatch between code and comments
Zifei Tong [Tue, 4 Mar 2014 12:50:14 +0000 (20:50 +0800)] 
Fix: mismatch between code and comments

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: incorrect urcu git URL in README
Mathieu Desnoyers [Mon, 10 Mar 2014 15:16:35 +0000 (11:16 -0400)] 
Fix: incorrect urcu git URL in README

Reported-by: Ruslan Uvashev <ruslan.uvashev@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.4.0 v2.4.0
Mathieu Desnoyers [Fri, 28 Feb 2014 18:33:51 +0000 (13:33 -0500)] 
Version 2.4.0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: JUL test: update to API change
Mathieu Desnoyers [Fri, 28 Feb 2014 18:26:28 +0000 (13:26 -0500)] 
Fix: JUL test: update to API change

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Cast from pointer to different integer size warning
Mathieu Desnoyers [Fri, 28 Feb 2014 15:40:33 +0000 (10:40 -0500)] 
Fix: Cast from pointer to different integer size warning

Occurs on a 32-bit build. Caused by casting pointer arguments to 64-bit
integers (in the filter stack preparation code).

Fixes #691

Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoTurn base address dump into experimental feature
Paul Woegerer [Fri, 28 Feb 2014 09:02:00 +0000 (10:02 +0100)] 
Turn base address dump into experimental feature

Instead of having base address state dump enabled by default make it
necessary to explicitly enable it with environment variable
LTTNG_UST_WITH_EXPERIMENTAL_BADDR_STATEDUMP.

Documentation is updated to reflect this change and explain about the
experimental nature of this feature.

Signed-off-by: Paul Woegerer <paul_woegerer@mentor.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: JUL support multiple loglevels
David Goulet [Thu, 27 Feb 2014 19:51:55 +0000 (14:51 -0500)] 
Fix: JUL support multiple loglevels

Fixes #744

Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Skip lttng-gen-tp example build if Python is missing
Jérémie Galarneau [Thu, 27 Feb 2014 17:30:41 +0000 (12:30 -0500)] 
Fix: Skip lttng-gen-tp example build if Python is missing

Fixes #665

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: dynamically fetch the session daemon port
David Goulet [Thu, 27 Feb 2014 16:53:22 +0000 (11:53 -0500)] 
Fix: dynamically fetch the session daemon port

When connecting to the session daemon, fetch the port at each try. This
moves the read port file functions to the TCP session daemon client
where the connect happens.

If the port file is not found, simply retry 3 seconds later. Also, this
adds a timeout to the acquire semaphore of 3 seconds.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
10 years agoFix: JUL agent connect to user and root sessiond
David Goulet [Thu, 27 Feb 2014 15:06:52 +0000 (10:06 -0500)] 
Fix: JUL agent connect to user and root sessiond

In order to achieve such a thing, two tracepoints are used where one is
for the regular user and the other one for root. This is to avoid
duplicating the payload in the user and root traces.

Furthermore, if a root port is found, a new thread is started to handle
the second session daemon.

This is lockstep commit with lttng-tools:
f43f95a9a82e01eed34593260d510bd32e2083ec

Fixes #732

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
10 years agoFix: handle registration done command
David Goulet [Wed, 26 Feb 2014 21:06:31 +0000 (16:06 -0500)] 
Fix: handle registration done command

This makes the getLTTngAgent() call wait until we receive that message
so that in the meantime the session daemon can enable events.

Fixes #692

Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Unsynchronized access in LTTngTCPSessiondClient
Jérémie Galarneau [Tue, 25 Feb 2014 21:32:05 +0000 (16:32 -0500)] 
Fix: Unsynchronized access in LTTngTCPSessiondClient

enabledEventList is shared between the LTTngThread and eventTimer
threads but is not synchronized.

This patch changes enabledEventList's type from an ArrayList to a
synchronized HashSet.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoCleanup: fix comment
Mathieu Desnoyers [Tue, 25 Feb 2014 11:43:46 +0000 (06:43 -0500)] 
Cleanup: fix comment

Fixes #652

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Dump executable base-address with readlink
Paul Woegerer [Tue, 25 Feb 2014 09:47:00 +0000 (10:47 +0100)] 
Fix: Dump executable base-address with readlink

The previous approach only worked if the traced executable was invoked
via its fully qualified path. Using readlink to determine the full
qualified path of the traced executable works reliably even when the
traced executable is started via PATH lookup.

Signed-off-by: Paul Woegerer <paul_woegerer@mentor.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: add assert for NULL dereference
Mathieu Desnoyers [Fri, 21 Feb 2014 18:16:20 +0000 (13:16 -0500)] 
Fix: add assert for NULL dereference

CID 1021248 (#1 of 1): Dereference null return value (NULL_RETURNS)3.
dereference: Dereferencing a null pointer "obj".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: tracepoint out of memory handling
Mathieu Desnoyers [Fri, 21 Feb 2014 18:13:14 +0000 (13:13 -0500)] 
Fix: tracepoint out of memory handling

CID 1021247 (#1 of 1): Dereference null return value (NULL_RETURNS)3.
dereference: Dereferencing a null pointer "pl".

Handle more gracefully add_callsite memory allocation failure too.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: dereference before null check
Mathieu Desnoyers [Fri, 21 Feb 2014 18:00:59 +0000 (13:00 -0500)] 
Fix: dereference before null check

Found by Coverity:
CID 1090602 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking "stream" suggests that it may be null,
but it has already been dereferenced on all paths leading to the check

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoCleanup: remove logically dead code
Mathieu Desnoyers [Fri, 21 Feb 2014 17:54:07 +0000 (12:54 -0500)] 
Cleanup: remove logically dead code

CID 1021235 (#1 of 1): Logically dead code (DEADCODE)
dead_error_line:
Execution cannot reach this statement "case LTTNG_UST_LOGLEVEL_ALL:".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: handle sysconf errors
Mathieu Desnoyers [Fri, 21 Feb 2014 16:01:01 +0000 (11:01 -0500)] 
Fix: handle sysconf errors

CID 1021261 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)10.
negative_returns: "sysconf(30)" is passed to a parameter that cannot be
negative.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: java-jul/Makefile should not be marked as a binary
Jérémie Galarneau [Tue, 18 Feb 2014 18:59:35 +0000 (13:59 -0500)] 
Fix: java-jul/Makefile should not be marked as a binary

java-jul/Makefile is part of bin_SCRIPTS which causes it to be
installed under /usr/local/bin.

It is already installed as an example.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.4.0-rc4 v2.4.0-rc4
Mathieu Desnoyers [Fri, 14 Feb 2014 16:42:38 +0000 (11:42 -0500)] 
Version 2.4.0-rc4

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoCleanup: remove extra space in dlerror wrapper
Mathieu Desnoyers [Fri, 14 Feb 2014 15:13:32 +0000 (10:13 -0500)] 
Cleanup: remove extra space in dlerror wrapper

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: work-around glibc lying about dlsym()/dlerror() leafness
Mathieu Desnoyers [Fri, 14 Feb 2014 15:02:51 +0000 (10:02 -0500)] 
Fix: work-around glibc lying about dlsym()/dlerror() leafness

Especially in the LTTng-UST malloc instrumentation, we run into the
following situation:

1) Our calloc wrapper is called,
2) we setup the static allocator,
3) we call dlsym() to lookup the symbol of the real allocator,
4) dlsym() calls into calloc(), which is overridden by our own wrapper.
   Our calloc does not see that the static allocator has been set,
   because the stores setting up the static allocator have been optimized
   away by gcc-4.8 (in O2), because the dlsym() prototype declares it
   with the "leaf" attribute, and thus we end up doing an infinite
   recursion, and eventually a segmentation fault.

Thanks to Alexander Monakov for pointing out the culprit of this glibc
bug.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoCleanup: add lttng_ust_malloc_wrapper_init prototype to header
Mathieu Desnoyers [Wed, 12 Feb 2014 22:00:58 +0000 (17:00 -0500)] 
Cleanup: add lttng_ust_malloc_wrapper_init prototype to header

Ensure the weak symbol prototype matches the non-weak function.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: malloc libc instrumentation wrapper
Mathieu Desnoyers [Sat, 8 Feb 2014 22:12:16 +0000 (17:12 -0500)] 
Fix: malloc libc instrumentation wrapper

calloc and realloc wrt dlsym and dlerror can trigger segmentation
faults. Ensure that we fully populate the allocator symbols all at once,
and also ensure that we use the static allocator while doing the dlsym
lookups.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: add LTTngEvent class to fix delayed logger
David Goulet [Fri, 7 Feb 2014 20:09:12 +0000 (15:09 -0500)] 
Fix: add LTTngEvent class to fix delayed logger

This commit introduces a new object called LTTngEvent that represent a
LTTng event containing some attributes, for now loglevel data.

Instead of moving event string name around, this object is created once
and kept in the log handler so once a record is publish we can match
attributes such as loglevels.

This has to be done in order to fix the issue where we have a Logger
that appears later on during runtime (with the timer that poll every 5
seconds). With a created event object we can lookup back the event
attributes and enabled it accordingly. Same goes with the * (all events)
where we now keep the loglevel values process wide so we can force the
new events to use it.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: FD leak in liblttng-ust-ctl
Mathieu Desnoyers [Fri, 7 Feb 2014 16:54:06 +0000 (11:54 -0500)] 
Fix: FD leak in liblttng-ust-ctl

Make sure wait/wakeup stream and channel FDs are closed at teardown.
This led to FD leaks on the consumer daemon when the relay daemon
disconnects unexpectedly.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: liblttng-ust-dl Makefile flags mismatch
Mathieu Desnoyers [Wed, 5 Feb 2014 00:38:48 +0000 (19:38 -0500)] 
Fix: liblttng-ust-dl Makefile flags mismatch

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: liblttng-ust-fork Makefile flags mismatch
Mathieu Desnoyers [Wed, 5 Feb 2014 00:38:19 +0000 (19:38 -0500)] 
Fix: liblttng-ust-fork Makefile flags mismatch

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: out of tree examples build
Mathieu Desnoyers [Tue, 4 Feb 2014 20:08:25 +0000 (15:08 -0500)] 
Fix: out of tree examples build

Fixes #664
Fixes #703

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: C++: incomplete extern C guard transition
Mathieu Desnoyers [Mon, 3 Feb 2014 18:41:35 +0000 (13:41 -0500)] 
Fix: C++: incomplete extern C guard transition

Recently, commits to fix SDT issues with extern C
(https://bugs.lttng.org/issues/597) brougt in compile errors when the
tracepoint is defined in the same file where the tracepoint provider is
created.

This was due to the presence of extern C guards in tracepoint-event.h, a
header dedicated to tracepoint probe provider compilation. After commits
"Tracepoint probes don't need extern C", it should have gone away. This
is the main fix done by this patch.

This patch also adds missing extern C guards in ust-error.h and
ust-events.h.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.4.0-rc3 v2.4.0-rc3
Mathieu Desnoyers [Wed, 29 Jan 2014 16:54:41 +0000 (11:54 -0500)] 
Version 2.4.0-rc3

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.054326 seconds and 4 git commands to generate.