lttng-ust.git
8 years agoFix: remove unlock in getcpu
Mathieu Desnoyers [Fri, 2 Sep 2016 19:20:41 +0000 (15:20 -0400)] 
Fix: remove unlock in getcpu

Causes unbalanced RCU read-side lock if nesting safety net is triggered.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: perf counters ABI rdpmc detection
Mathieu Desnoyers [Mon, 27 Jun 2016 21:40:00 +0000 (17:40 -0400)] 
Fix: perf counters ABI rdpmc detection

Copy Linux kernel perf_event.h installed headers into lttng-ust to know
the recent ABI layout, and use the bit description detailed in the
following Linux kernel commit:

https://github.com/torvalds/linux/commit/fa7315871046b9a4c48627905691dbde57e51033

to check whether the kernel supports rdpmc.

Fall-back on the perf read system call for kernels prior to 3.12,
because older kernels have an ABI bug where a union was used for both
cap_usr_time and cap_usr_rdpmc.

Also fall-back on the perf read system call for kernels that do not
support rdpmc.

Ensure setup_perf set the pc pointer value before checking whether we
need to the file descriptor open or not.

This combines the following master commits:

* Fix: perf counters build against kernel headers < 3.12
* Add generic fallback for perf counter read
* Fix: lttng context perf: missing stdbool.h header include
* Add perf context support for ARMv7
  (removed the ARM-specific lines when combining)
* Keep perf context FD open for other architectures

Since this is a bugfix, we explicitly do not enable building perf
support for other architectures, as this would introduce a feature in
the stable release cycle.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: perf counter context deadlock
Mathieu Desnoyers [Thu, 18 Aug 2016 20:07:30 +0000 (16:07 -0400)] 
Fix: perf counter context deadlock

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: many-events registration/unregistration speed
Mathieu Desnoyers [Mon, 8 Aug 2016 21:08:00 +0000 (17:08 -0400)] 
Fix: many-events registration/unregistration speed

Batch invocation of synchronize_rcu() when unregistering many events
from a session.

Also batch invocation of synchronize_rcu() when registering the same
events within many concurrent sessions (starting from the 2nd session).

Those slowdowns are noticeable with applications processes that have a
short life-time, e.g. shell scripts spawning multiple short-lived
processes take significantly longer to complete when LD_PRELOADing a UST
probe provider.

This slowdown only occurs when UST tracing sessions are created in the
session daemon.

tracepoint_probe_update_all() (currently unused) implements a similar
mechanism which has the downside of iterating on all events in all probe
libraries (not as efficient). Move synchronize_rcu() in
tracepoint_probe_update_all() outside of the iteration on all events to
free in this function, because it is only needed between the last
callsite update and the first memory reclaim, not between list removal
and reclaim.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: pre-fault TLS in ust-malloc instrumentation
Mathieu Desnoyers [Tue, 26 Jul 2016 20:54:55 +0000 (16:54 -0400)] 
Fix: pre-fault TLS in ust-malloc instrumentation

Faulting the TLS variable when accessed for the first time can trigger
deadlocks with internal libc lock when using the liblttng-ust-malloc
wrapper. Fix this by pre-faulting it in a library constructor, similarly
to the approach taken for all other TLS variables in lttng-ust.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: reset vtid cache before releasing urcu locks
Mathieu Desnoyers [Thu, 14 Jul 2016 21:47:08 +0000 (17:47 -0400)] 
Fix: reset vtid cache before releasing urcu locks

When tracing pthread mutex lock/unlock, we need to reset the vtid
context cache before unlocking the urcu lock, else we have vtid/vpid
discrepancies.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: cleanup local_apps.allowed flag on lib cleanup
Mathieu Desnoyers [Thu, 14 Jul 2016 16:21:13 +0000 (12:21 -0400)] 
Fix: cleanup local_apps.allowed flag on lib cleanup

In case of applications using fork/clone, which drop their privileges,
we need to clear the local_apps.allowed flag, otherwise those
application get an assertion when using the liblttng-ust-fork helper:

e.g.
varnishd: lttng-ust-comm.c:423: setup_local_apps: Assertion `local_apps.allowed == 0' failed.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: remove invalid free
Mathieu Desnoyers [Tue, 12 Jul 2016 13:51:40 +0000 (09:51 -0400)] 
Fix: remove invalid free

On this error path, we should not free lttng_chan, because it is located
within an allocated shm memory area associated with the channel now. It
is invalid to free this pointer.

This is invoked on a channel creation error path.

Reported-by: Aravind HT <aravind.ht@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: perf counters: sign-extend pmc register
Mathieu Desnoyers [Wed, 6 Jul 2016 18:47:00 +0000 (14:47 -0400)] 
Fix: perf counters: sign-extend pmc register

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: allow non-LGPL modules to use tracepoints
Mathieu Desnoyers [Wed, 15 Jun 2016 20:34:09 +0000 (16:34 -0400)] 
Fix: allow non-LGPL modules to use tracepoints

Non-LGPL modules that use tracepoint instrumentation, but have no
compile unit defining either TRACEPOINT_DEFINE or
TRACEPOINT_CREATE_PROBES fail to build due to undefined reference to
`tracepoint_dlopen_ptr'.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: strerror_r behavior is glibc specific
Michael Jeanson [Mon, 30 May 2016 20:31:31 +0000 (16:31 -0400)] 
Fix: strerror_r behavior is glibc specific

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: don't generate 0-len array in tracepoint probes
Mathieu Desnoyers [Mon, 30 May 2016 16:47:50 +0000 (18:47 +0200)] 
Fix: don't generate 0-len array in tracepoint probes

It is forbidden by C99, and gcc/g++ in pedantic mode generates errors
for e.g. field-less events.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: log4j example: set logger level to prevent unexpected level inheritance
Jonathan Rajotte [Thu, 26 May 2016 22:05:12 +0000 (18:05 -0400)] 
Fix: log4j example: set logger level to prevent unexpected level inheritance

BSF or other jars can ship with log4j.properties file embedded. This
causes problem when launching application with a general class path (e.g
/usr/share/java/*) since log4j will look for a property file in all
loaded jars. If any contains directive for the root logger it will
affect any logger with no level who are directly under the root logger.
This could result in an unexpected behaviour (e.g no events triggered
etc.).

Link: https://issues.apache.org/jira/browse/BSF-24
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: initialize RCU callbacks with mixed LGPL/non-LGPL objects
Mathieu Desnoyers [Wed, 25 May 2016 21:19:35 +0000 (17:19 -0400)] 
Fix: initialize RCU callbacks with mixed LGPL/non-LGPL objects

Linking both _LGPL_SOURCE and non-_LGPL_SOURCE objects into the same
module may result in having the RCU callbacks left to NULL, which
prevents tracing for tracepoints and/or probes which sit in the non-LGPL
compile unit.

This happens if the contructor of the LGPL compile unit is executed
first, thus incrementing the __tracepoint_registered counter, which will
prevent later execution of that same constructor in the non-LGPL compile
unit to initialize the RCU callbacks in __tracepoint__init_urcu_sym().

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: incorrect structure layout with mixed LGPL/non-LGPL objects
Mathieu Desnoyers [Wed, 25 May 2016 21:17:41 +0000 (17:17 -0400)] 
Fix: incorrect structure layout with mixed LGPL/non-LGPL objects

Linking both _LGPL_SOURCE and non-_LGPL_SOURCE objects into the same
module may result in corruption. If the tracepoint_dlopen object used is
the one declared by a LGPL compile unit, a non-LGPL compile unit may try
to initialize fields beyond the end of the structure.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: don't call __builtin_return_address(0) on 32-bit powerpc
Mathieu Desnoyers [Tue, 24 May 2016 22:58:14 +0000 (18:58 -0400)] 
Fix: don't call __builtin_return_address(0) on 32-bit powerpc

Invoking __builtin_return_address(0) corrupts the stack, as previously
noticed for the "ip" context. Disable its use on 32-bit powerpc
everywhere else in the lttng-ust code base.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: tracepoint header: declare tracepoint_dlopen_ptr
Mathieu Desnoyers [Mon, 23 May 2016 16:06:33 +0000 (12:06 -0400)] 
Fix: tracepoint header: declare tracepoint_dlopen_ptr

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: update debug message about weak-hidden symbols
Mathieu Desnoyers [Mon, 23 May 2016 15:37:07 +0000 (11:37 -0400)] 
Fix: update debug message about weak-hidden symbols

We actually deal OK with compilers that treats weak-hidden symbols as
different addresses between compile units part of the same module.
Simply report this without statement on whether or not the compiler
producing this code is broken.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: tracepoint-rcu header: use tracepoint_dlopen_ptr
Mathieu Desnoyers [Mon, 23 May 2016 15:05:21 +0000 (11:05 -0400)] 
Fix: tracepoint-rcu header: use tracepoint_dlopen_ptr

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: work-around gcc optimisation oddness on 32-bit powerpc
Mathieu Desnoyers [Mon, 23 May 2016 00:07:48 +0000 (20:07 -0400)] 
Fix: work-around gcc optimisation oddness on 32-bit powerpc

Deal with gcc O1 optimisation issues with weak hidden symbols. gcc 4.8
and prior does not have the same behavior for symbol scoping on 32-bit
powerpc depending on the object size: symbols for objects of 8 bytes or
less have the same address throughout a module, whereas they have
different addresses between compile units for objects larger than 8
bytes. Add this pointer indirection to ensure that the symbol scoping
match that of the other weak hidden symbols found in tracepoint.h.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoVersion 2.7.4 v2.7.4
Mathieu Desnoyers [Fri, 20 May 2016 20:58:26 +0000 (16:58 -0400)] 
Version 2.7.4

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPrint DBG() message about compiler weak hidden symbol behavior
Mathieu Desnoyers [Fri, 20 May 2016 19:23:06 +0000 (15:23 -0400)] 
Print DBG() message about compiler weak hidden symbol behavior

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoDocumentation: ring buffer: SWITCH_FLUSH can be used when active
Mathieu Desnoyers [Wed, 18 May 2016 14:06:45 +0000 (10:06 -0400)] 
Documentation: ring buffer: SWITCH_FLUSH can be used when active

Snapshot mode tracing may use SWITCH_FLUSH while tracing is active.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: unchecked return value in trace_clock_read64_monotonic
Mathieu Desnoyers [Tue, 17 May 2016 16:05:10 +0000 (12:05 -0400)] 
Fix: unchecked return value in trace_clock_read64_monotonic

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Java agent should use LTTNG_HOME
Mathieu Desnoyers [Wed, 11 May 2016 00:37:36 +0000 (20:37 -0400)] 
Fix: Java agent should use LTTNG_HOME

Both in UST C/C++ support and Python agent, LTTNG_HOME can be used to
override HOME for lttng-ust. Ensure the Java agent has the same
behavior.

Fixes: #881
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: examples make distcheck failure
Mathieu Desnoyers [Tue, 10 May 2016 22:10:43 +0000 (18:10 -0400)] 
Fix: examples make distcheck failure

"make distcheck" marks each source file on the srcdir in the extracted
dist tarball read-only. The examples copy from the srcdir into the
builddir before running the "make" examples, but this keeps the
read-only flag on the builddir directories, which fails the build
because the resulting objects cannot be created.

Fix this by ensuring the copied target directory for each example is
user-writeable.

Fixes: #903
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: endianness of integers received by filter
Mathieu Desnoyers [Tue, 26 Apr 2016 22:39:38 +0000 (18:39 -0400)] 
Fix: endianness of integers received by filter

We need to byteswap integers passed to the filter when they are tagged
as being in an endianness which differs from the architecture
endianness, so the integer comparisons make sense in terms of value
rather than raw bytes for those fields.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoVersion 2.7.3 v2.7.3
Mathieu Desnoyers [Tue, 26 Apr 2016 20:47:03 +0000 (16:47 -0400)] 
Version 2.7.3

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoDoc: Update README.d
Michael Jeanson [Mon, 25 Apr 2016 19:08:08 +0000 (15:08 -0400)] 
Doc: Update README.d

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: doc/examples: remove unexpected quotes from run files
Mathieu Desnoyers [Tue, 12 Apr 2016 00:43:26 +0000 (20:43 -0400)] 
Fix: doc/examples: remove unexpected quotes from run files

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: remove dead code from filter interpreter
Mathieu Desnoyers [Tue, 5 Apr 2016 13:30:31 +0000 (09:30 -0400)] 
Fix: remove dead code from filter interpreter

This has been detected in the lttng-modules port of the filter
interpreter by Coverity. The intent of the code in UST is similar, and
we can find the same dead code, although Coverity may not see it as dead
code because it cannot prove that the string is not modified between the
two uses. Since we know it is not modified, remove the dead code.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: remove assertions in lttng-ust-comm init
Mathieu Desnoyers [Wed, 16 Mar 2016 13:55:10 +0000 (09:55 -0400)] 
Fix: remove assertions in lttng-ust-comm init

Assertions in the lttng-ust-comm init function are slightly too harsh
for their own good. In situations involving incoherent seccomp profiles
(e.g. accepting futex, poll, nanosleep, clock_nanosleep, but not
restart_syscall), unexpected errno values can be returned by
sem_timedwait.

Print an error in those situations, but let the application proceed.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoDocumentation: fix manpage typo
Mathieu Desnoyers [Thu, 10 Mar 2016 20:21:00 +0000 (15:21 -0500)] 
Documentation: fix manpage typo

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoVersion 2.7.2 v2.7.2
Mathieu Desnoyers [Thu, 10 Mar 2016 01:29:44 +0000 (20:29 -0500)] 
Version 2.7.2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: disable use of __builtin_return_address(0) on 32-bit PowerPC
Mathieu Desnoyers [Wed, 17 Feb 2016 23:18:17 +0000 (18:18 -0500)] 
Fix: disable use of __builtin_return_address(0) on 32-bit PowerPC

It causes stack corruption in the tracepoint event probes.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: handle negative range for LTTNG_UST_REGISTER_TIMEOUT
Mathieu Desnoyers [Fri, 12 Feb 2016 20:44:10 +0000 (15:44 -0500)] 
Fix: handle negative range for LTTNG_UST_REGISTER_TIMEOUT

We should not consider values below -1 as valid timeout values, this is
is unexpected and could lead to EINVAL errors returned by sem_timedwait.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Ensure the Java JUL messages are correctly formatted
Alexandre Montplaisir [Thu, 4 Feb 2016 20:02:57 +0000 (15:02 -0500)] 
Fix: Ensure the Java JUL messages are correctly formatted

It is possible for log records to contain messages that need some
formatting, for example if the string contains localized elements
or if the log(Level, String, Object[]) method is used.

In these cases, we need to make sure to format the string and not
pass the "raw" string to the tracepoint.

This only applies to the JUL API. log4j 1.2.x did not handle such
formatting, although log4j 2.x does.

This is a backport of commit 4721f9c to the stable-2.7 branch.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: double-free on error sending fields
Mathieu Desnoyers [Fri, 15 Jan 2016 16:31:29 +0000 (11:31 -0500)] 
Fix: double-free on error sending fields

Found by Coverity:
*** CID 1348462:    (USE_AFTER_FREE)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoVersion 2.7.1 v2.7.1
Mathieu Desnoyers [Thu, 26 Nov 2015 16:56:40 +0000 (11:56 -0500)] 
Version 2.7.1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: header size larger than 256 bytes
Mathieu Desnoyers [Sun, 25 Oct 2015 15:25:31 +0000 (11:25 -0400)] 
Fix: header size larger than 256 bytes

When adding large context (e.g. callstack), headers larger than 256
bytes cause discrepancy between calculated size and size written into
the trace buffers. This generates a corrupted trace and triggers a
warning in ring buffer backend, which triggers a safety net disabling
tracing for the current channel.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoRemove stale tests/java-jul test
Mathieu Desnoyers [Thu, 22 Oct 2015 20:51:49 +0000 (16:51 -0400)] 
Remove stale tests/java-jul test

This test has been superseded by lttng-tools tests and
https://github.com/lttng/lttng-ust-java-tests .

This test was not in configure.ac nor had any automake Makefile.am
anyway.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: live timer calculation error
Mikael Beckius [Tue, 12 May 2015 09:04:34 +0000 (11:04 +0200)] 
Fix: live timer calculation error

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

Signed-off-by: Mikael Beckius <mikael.beckius@windriver.com>
Signed-off-by: Jianchuan Wang <jianchuan.wang@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix python agent build/install/uninstall with DESTDIR specified
Jonathan Rajotte [Fri, 16 Oct 2015 19:07:31 +0000 (15:07 -0400)] 
Fix python agent build/install/uninstall with DESTDIR specified

Remove the install_files.txt record since it's simpler to delete the
complete folder on uninstall.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Don't (re)define STAP_PROBEV
Stelios Bounanos [Wed, 14 Oct 2015 16:31:36 +0000 (17:31 +0100)] 
Fix: Don't (re)define STAP_PROBEV

Define a new LTTNG_STAP_PROBEV macro to avoid clobbering STAP_PROBEV or
emitting unwanted sdt probes when lttng-ust has been built without sdt
support.

Signed-off-by: Stelios Bounanos <sb@enotty.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoVersion 2.7.0 v2.7.0
Mathieu Desnoyers [Thu, 24 Sep 2015 21:14:10 +0000 (17:14 -0400)] 
Version 2.7.0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: don't dereference NULL pointers
Mathieu Desnoyers [Mon, 21 Sep 2015 20:44:38 +0000 (16:44 -0400)] 
Fix: don't dereference NULL pointers

Detected by scan-build.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: Remove unused values
Mathieu Desnoyers [Mon, 21 Sep 2015 20:01:06 +0000 (16:01 -0400)] 
Cleanup: Remove unused values

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Value stored to 'has_waited' is never read
Mathieu Desnoyers [Mon, 21 Sep 2015 19:57:36 +0000 (15:57 -0400)] 
Fix: Value stored to 'has_waited' is never read

Reported by scan-build.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Argument with 'nonnull' attribute passed null
Mathieu Desnoyers [Mon, 21 Sep 2015 19:47:09 +0000 (15:47 -0400)] 
Fix: Argument with 'nonnull' attribute passed null

Reported by scan-build
API Argument with 'nonnull' attribute passed null libringbuffer
/ring_buffer_backend.c 380
API Argument with 'nonnull' attribute passed null libringbuffer
/ring_buffer_backend.c  420

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: Unnecessary bit shift
Jonathan Rajotte [Mon, 21 Sep 2015 18:31:33 +0000 (14:31 -0400)] 
Cleanup: Unnecessary bit shift

Reported by cppcheck [1].

[1]
https://ci.lttng.org/view/Code%20quality/job/lttng-ust_master_cppcheck/5/cppcheckResult/source.10/

Proposed-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: sysconf() unchecked return value
Mathieu Desnoyers [Mon, 21 Sep 2015 17:43:08 +0000 (13:43 -0400)] 
Fix: sysconf() unchecked return value

Fix Coverity bug:

CID 1021259 (#1 of 1): Improper use of negative value
(NEGATIVE_RETURNS)5. negative_returns: sysconf(_SC_PAGESIZE) is passed
to a parameter that cannot be negative.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agodoc: add Python example
Philippe Proulx [Sat, 5 Sep 2015 17:47:13 +0000 (13:47 -0400)] 
doc: add Python example

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Python agent: do not register twice to same port
Philippe Proulx [Sat, 5 Sep 2015 17:38:01 +0000 (13:38 -0400)] 
Fix: Python agent: do not register twice to same port

It is possible that one of the session daemons left its agent.port
file on the file system, for example when killed with SIGKILL. It
is also common that both those session daemons use the same port for
listening to agent connections. In this case, if one session daemon
is running, but two agent.port files exist, the Python agent would
connect its two threads to the same session daemon, leading to
everything done twice: list shows events twice, tracing records
events twice, etc.

This patch ensures that if two agent.port files are found and have
the same content, only one thread is used.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoVersion 2.7.0-rc2 v2.7.0-rc2
Mathieu Desnoyers [Wed, 9 Sep 2015 20:36:43 +0000 (16:36 -0400)] 
Version 2.7.0-rc2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: close socket on protocol error, sendmsg MSG_NOSIGNAL
Mathieu Desnoyers [Wed, 26 Aug 2015 22:24:11 +0000 (18:24 -0400)] 
Fix: close socket on protocol error, sendmsg MSG_NOSIGNAL

Don't try to keep interacting with sessiond when a protocol error is
detected at the UST application side: this means we cannot trust the
protocol anymore, so there is no reason for keeping the socket open.
For instance, if the application is exiting and we receive a new stream,
we're effectively not reading the stream data, and we return an error.
Unfortunately, the session daemon may try to send us another command,
but we will try interpreting the stream data as a command, which is
invalid.

Also, use MSG_NOSIGNAL flag in the fds recvmsg, so the session daemon
don't get killed with SIGPIPE when it cannot send to the socket due to
connection closed.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: more descriptive error message
Mathieu Desnoyers [Tue, 25 Aug 2015 11:12:51 +0000 (07:12 -0400)] 
Cleanup: more descriptive error message

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add missing ust lock around objd_table_destroy()
Mathieu Desnoyers [Fri, 21 Aug 2015 23:11:56 +0000 (16:11 -0700)] 
Fix: add missing ust lock around objd_table_destroy()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: application exit race with pthread cancel
Mathieu Desnoyers [Mon, 17 Aug 2015 16:50:34 +0000 (09:50 -0700)] 
Fix: application exit race with pthread cancel

Listener threads can be cancelled with ust lock held, which can hang the
following ust cleanup routine, because tracepoint probe unregister needs
to take the ust lock.

Fix this by disabling pthread cancellation for the entire duration of
the ust lock.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: configure layout for python agent detection
Mathieu Desnoyers [Tue, 11 Aug 2015 16:11:57 +0000 (12:11 -0400)] 
Cleanup: configure layout for python agent detection

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoBuild: python agent: use setup.py over autoconf
Jonathan Rajotte [Mon, 10 Aug 2015 18:45:34 +0000 (14:45 -0400)] 
Build: python agent: use setup.py over autoconf

This change provides a valid way of installing the agent. The autoconf
python macro provides the wrong installation path for
python 3 under Debian and Ubuntu due to distro-specific packaging for
python 2.7 and 3.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoBuild: add python interpreter used by python agent if built
Jonathan Rajotte [Mon, 10 Aug 2015 18:45:33 +0000 (14:45 -0400)] 
Build: add python interpreter used by python agent if built

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoDoc: basic lttng ust python agent documentation
Jonathan Rajotte [Mon, 10 Aug 2015 18:45:32 +0000 (14:45 -0400)] 
Doc: basic lttng ust python agent documentation

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoBuild: use AM_PATH_PYTHON to resolve python when building agent
Jonathan Rajotte [Mon, 10 Aug 2015 18:45:31 +0000 (14:45 -0400)] 
Build: use AM_PATH_PYTHON to resolve python when building agent

The agent can be built against a forced python version by exporting
PYTHON environment variable at configure time.

ex:
$ export PYTHON=python3
$ ./configure --enable-python-agent

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoBuild: only check if python exists in path
Jonathan Rajotte [Mon, 10 Aug 2015 18:45:30 +0000 (14:45 -0400)] 
Build: only check if python exists in path

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoDoc: add LTTNG_UST_CLOCK_PLUGIN to man page
Jonathan Rajotte [Thu, 23 Jul 2015 20:02:51 +0000 (16:02 -0400)] 
Doc: add LTTNG_UST_CLOCK_PLUGIN to man page

Also add indications on how to use the plugin with lttng-tools.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoDoc: add LTTNG_UST_GETCPU_PLUGIN to man page
Jonathan Rajotte [Thu, 23 Jul 2015 20:02:50 +0000 (16:02 -0400)] 
Doc: add LTTNG_UST_GETCPU_PLUGIN to man page

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Java agent: update ref count in enabledLoggers
Philippe Proulx [Mon, 3 Aug 2015 20:40:03 +0000 (16:40 -0400)] 
Fix: Java agent: update ref count in enabledLoggers

Integer objects are immutable in Java, so

    Integer refcount = enabledLoggers.get(name);
    refcount--;

does not update the value in enabledLoggers.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoRename Python agent tracepoint to "event"
Jérémie Galarneau [Thu, 30 Jul 2015 20:43:21 +0000 (16:43 -0400)] 
Rename Python agent tracepoint to "event"

This rename comes as an effort to remain consistent with the tracepoint
naming scheme used by Log4J and JUL.

The associated change in lttng-tools is introduced as of d8c7bda0.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: remove generated file from git tree
Mathieu Desnoyers [Thu, 16 Jul 2015 16:07:27 +0000 (12:07 -0400)] 
Fix: remove generated file from git tree

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoVersion 2.7.0-rc1 v2.7.0-rc1
Mathieu Desnoyers [Wed, 15 Jul 2015 18:42:05 +0000 (14:42 -0400)] 
Version 2.7.0-rc1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Use $enableval with AC_ARG_ENABLE
Michael Jeanson [Wed, 8 Jul 2015 18:24:57 +0000 (14:24 -0400)] 
Fix: Use $enableval with AC_ARG_ENABLE

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Cleanup local_apps sock_info in lttng_ust_cleanup
Jérémie Galarneau [Tue, 7 Jul 2015 18:35:54 +0000 (14:35 -0400)] 
Fix: Cleanup local_apps sock_info in lttng_ust_cleanup

LTTng-UST will deadlock after a fork while waiting on the
"constructor_wait" semaphore if local apps, handled the session daemon
running under the current UID, are disabled or "not_allowed".

This deadlock can be triggered by setting an infinite registration
timeout, clearing the HOME environment variable and launching an app
which calls FORK(3). This will cause setup_local_apps() to fail to
determine the local_apps sock_path, thus leaving
local_apps.allowed == 0.

This, in turn, would cause lttng_ust_cleanup to skip the cleanup
of the local_apps sock_info after a fork,
leaving local_apps.constructor_sem_posted == 1. This would cause
handle_register_done() in the child to skip over the decrementation
of sem_count and post of the constructor_wait semaphore.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: handle sys_futex EINTR and EWOULDBLOCK
Mathieu Desnoyers [Mon, 6 Jul 2015 21:09:32 +0000 (17:09 -0400)] 
Fix: handle sys_futex EINTR and EWOULDBLOCK

Handling sys_futex EINTR allows us to retry waiting on the futex
immediately if we are interrupted by a signal without having to try
connecting to the session daemon.

This should not impact correctness though, as the wait scheme would
simply try to connect, fail, and try waiting again.

Also handle errors on FUTEX_WAKE.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: update liburcu URL
Mathieu Desnoyers [Thu, 2 Jul 2015 21:11:22 +0000 (17:11 -0400)] 
Fix: update liburcu URL

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years ago.gitignore: ignore Python agent generated files
Philippe Proulx [Tue, 30 Jun 2015 23:45:10 +0000 (19:45 -0400)] 
.gitignore: ignore Python agent generated files

Reported-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
9 years agoAdd ctf_sequence_hex() macro
Philippe Proulx [Tue, 30 Jun 2015 23:39:36 +0000 (19:39 -0400)] 
Add ctf_sequence_hex() macro

This patch adds the `_elem_type_base` parameter to
the internal _ctf_sequence_encoded() macro to
specify the sequence's element type's base.

ctf_sequence_hex() sets the `_elem_type_base`
parameter to 16.

This is convenient for recording byte buffers and
viewing them in hexadecimal.

Suggested-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
9 years agoFix: set soinfo_data's vdso flag correctly in base address statedump
Antoine Busque [Tue, 30 Jun 2015 21:59:01 +0000 (17:59 -0400)] 
Fix: set soinfo_data's vdso flag correctly in base address statedump

The vdso flag is set to 0 when the executable can be found on disk.

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: running java examples out of tree
Michael Jeanson [Tue, 30 Jun 2015 21:32:56 +0000 (17:32 -0400)] 
Fix: running java examples out of tree

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: java class check when uudecode is not present
Michael Jeanson [Tue, 30 Jun 2015 20:59:54 +0000 (16:59 -0400)] 
Fix: java class check when uudecode is not present

On systems where 'uudecode' is present, the java class check will
run a precompiled class file in the local directory. If the CLASSPATH
variable doesn't contain "." the test will fail regardless of the
presence of the tested for class on the classpath.

This fix makes the behavior of the test consistant whether 'uudecode'
is present or not.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: remove extra whitespace in configure output
Mathieu Desnoyers [Tue, 30 Jun 2015 17:04:27 +0000 (13:04 -0400)] 
Cleanup: remove extra whitespace in configure output

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoDefault to no unaligned access on unsupported archs
Michael Jeanson [Tue, 30 Jun 2015 15:55:40 +0000 (11:55 -0400)] 
Default to no unaligned access on unsupported archs

[ Edit by Mathieu: change configure output style to match current style. ]

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agocleanup: Coding style fixes to the Java agent
Alexandre Montplaisir [Mon, 29 Jun 2015 20:55:00 +0000 (16:55 -0400)] 
cleanup: Coding style fixes to the Java agent

- Use camelCase for regular members and FULL_CAPS for static final
  ones (except for API classes).
- All members of an interface are public static final by default,
  no need to repeat the modifiers.
- Marked final some fields that could be.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
9 years agocleanup: Mark obsolete JUL agent as @Deprecated
Alexandre Montplaisir [Mon, 29 Jun 2015 20:32:22 +0000 (16:32 -0400)] 
cleanup: Mark obsolete JUL agent as @Deprecated

Java has a @Deprecated annotation to indicate deprecated classes
(or methods, members, etc.). This will keep the code available for
backwards compatibility, but will emit a warning to any user calling
it.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
9 years agoFix compilation warnings in the Java agent
Alexandre Montplaisir [Fri, 26 Jun 2015 22:03:31 +0000 (18:03 -0400)] 
Fix compilation warnings in the Java agent

- Remove unused imports.
- Access static fields statically.
- Mark static methods that can be.
- Remove exception declarations that are not actually thrown
  (on non-API methods only).

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
9 years agoFix: out of tree build of java agents
Michael Jeanson [Thu, 25 Jun 2015 23:10:54 +0000 (19:10 -0400)] 
Fix: out of tree build of java agents

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Use env CLASSPATH when building log4j example
Michael Jeanson [Thu, 25 Jun 2015 23:00:22 +0000 (19:00 -0400)] 
Fix: Use env CLASSPATH when building log4j example

The location of the log4j jar file is specified during configure with
the CLASSPATH envvar, reuse it when building the example.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: build log4j example when enabled
Michael Jeanson [Thu, 25 Jun 2015 21:13:07 +0000 (17:13 -0400)] 
Fix: build log4j example when enabled

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoBump tracer version to 2.7.0-pre
Mathieu Desnoyers [Tue, 23 Jun 2015 17:36:47 +0000 (13:36 -0400)] 
Bump tracer version to 2.7.0-pre

Trace viewers use the tracer minor version to know which event name to
expect for the statedump. Since we changed the namespacing of those
events for 2.7, switch the tracer minor version to "7" before rc1, hence
the use of "pre" at this stage of the release process.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: perform volatile load of tracepoint state
Mathieu Desnoyers [Mon, 22 Jun 2015 14:30:02 +0000 (10:30 -0400)] 
Fix: perform volatile load of tracepoint state

Because tracepoint state is updated by lttng-ust threads, and read by
application threads, we need to perform a volatile load of that state.

Not having the volatile load can cause the compiler to optimize away the
reload of that state, keeping a local copy instead. For instance, a main
program consisting of a loop could keep the tracepoint state on its
stack or in registers without ever reloading it from memory.

Perform a volatile load (CMM_LOAD_SHARED()) of the tracepoint state.
Add the matching volatile store (CMM_STORE_SHARED()) in tracepoint.c for
the state update.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAdd demo-tracelog to gitignore file
Mathieu Desnoyers [Thu, 18 Jun 2015 18:42:56 +0000 (14:42 -0400)] 
Add demo-tracelog to gitignore file

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAdd aarch64 support to configure
Michael Jeanson [Thu, 18 Jun 2015 14:41:55 +0000 (10:41 -0400)] 
Add aarch64 support to configure

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoImplement cpu_id context for filtering
Mathieu Desnoyers [Sat, 13 Jun 2015 09:27:07 +0000 (11:27 +0200)] 
Implement cpu_id context for filtering

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoust cyg-profile: use same class for entry and exit
Mathieu Desnoyers [Wed, 10 Jun 2015 11:32:30 +0000 (13:32 +0200)] 
ust cyg-profile: use same class for entry and exit

Share same serialization functions for entry and exit events.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: function instrumentation ip context
Mathieu Desnoyers [Wed, 10 Jun 2015 11:27:18 +0000 (13:27 +0200)] 
Fix: function instrumentation ip context

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: liblttng-ust-dl ip context
Mathieu Desnoyers [Wed, 10 Jun 2015 11:20:31 +0000 (13:20 +0200)] 
Fix: liblttng-ust-dl ip context

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoRemove caller field from malloc events
Mathieu Desnoyers [Wed, 10 Jun 2015 11:17:33 +0000 (13:17 +0200)] 
Remove caller field from malloc events

This duplicates info now available in the "ip" context.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: pthread wrapper ip context
Mathieu Desnoyers [Wed, 10 Jun 2015 11:15:28 +0000 (13:15 +0200)] 
Fix: pthread wrapper ip context

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: lttng-ust-malloc ip context
Mathieu Desnoyers [Wed, 10 Jun 2015 11:15:09 +0000 (13:15 +0200)] 
Fix: lttng-ust-malloc ip context

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAllow TP_IP_PARAM arg name to be configured
Mathieu Desnoyers [Wed, 10 Jun 2015 11:14:08 +0000 (13:14 +0200)] 
Allow TP_IP_PARAM arg name to be configured

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agotracelog: use same class for all loglevels
Mathieu Desnoyers [Wed, 10 Jun 2015 06:54:37 +0000 (08:54 +0200)] 
tracelog: use same class for all loglevels

Each loglevel can be serialized by the exact same serialization
function. Therefore, use a single tracepoint class for all those.

This diminishes the code size of the probe, and therefore its impact on
the instruction cache.

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