Francis Deslauriers [Thu, 6 May 2021 21:50:03 +0000 (17:50 -0400)]
Fix: builtin script referring to old directories
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I30fb8abb1a69d6695552947e30cf2b43d3db36b3
Mathieu Desnoyers [Thu, 6 May 2021 20:42:52 +0000 (16:42 -0400)]
events.h API const-ness
Ensure events.h definitions, fields, and arguments referring to const
arrays of pointers are const.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id1f9a736de72220f7576d9780b82ab7879eac300
Mathieu Desnoyers [Thu, 6 May 2021 20:32:32 +0000 (16:32 -0400)]
Rename struct lib_ring_buffer* to struct lttng_kernel_ring_buffer*
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I61b5a78c6485422ae4a2e2e45e32465db82b3d97
Mathieu Desnoyers [Thu, 6 May 2021 20:08:37 +0000 (16:08 -0400)]
Rename struct channel to struct lttng_kernel_ring_buffer_channel
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifb737dfa71c9fdd08b62680f7782328b50a70d61
Mathieu Desnoyers [Thu, 6 May 2021 18:07:56 +0000 (14:07 -0400)]
Refactoring: struct lttng_channel
Split lttng_channel into public/private structures, and introduce
inheritance for common fields which will be shared between the channel
buffer and upcoming channel counter.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I932231c4af9ed1066d010b5be4f75f34842e8484
Francis Deslauriers [Thu, 6 May 2021 19:21:13 +0000 (15:21 -0400)]
Fix: missing #include for 3.8 kernel
Change-Id: If13a6615c2bed93d887047b6feaf377107d98cf9
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 6 May 2021 15:48:42 +0000 (11:48 -0400)]
Introduce struct lttng_kernel_tracepoint_class, enum probe_desc field
Introduce struct lttng_kernel_tracepoint_class to clearly split the
event instance from the class, thus allowing the event instance to refer
to the class through a single symbol. This removes the need to rely on
ARRAY_SIZE() to calculate the size of the event field array (part of the
class) from within the event instance. This refactoring opens the door
to have event class and instance not only in different providers, but
also in providers emitted within different compile units and shared
objects in the future.
While refactoring kprobes, uprobes and kretprobes code, there is a lot
of dynamically allocated memory which can be turned into static data
structures for tp_class, fields and types. This simplification ends up
fixing a few memory leaks as well.
Introduce a probe_desc field in the enumeration descriptor to keep the
same pattern for both tp_class and enumerations.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I221ad33383de48144d0d14b2b461ecb38dfb54ab
Mathieu Desnoyers [Wed, 5 May 2021 20:01:19 +0000 (16:01 -0400)]
Set probe descriptor field in event descriptor
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8afd12cae160fbd7637fb2f9528309f5245f77cf
Francis Deslauriers [Fri, 30 Apr 2021 21:30:48 +0000 (17:30 -0400)]
Split syscall tracepoint generation in their own files
This commit tracepoint generation of the 4 different types of syscalls
(entry, exit, entry_compat, and exit_compat) each in their own .c file.
The compilation time of the lttng-modules projects is currently
dominated by the compilation of the src/lttng-syscalls.o object.
This is caused by the extensive use of macros to generate tracepoint for
all syscalls. This also uses a lot of memory making the compilation of
the project tedious on system with low memory.
This allows for parallelization of the compilation which offers 2
improvements: Reduction of compilation time and reduction of the memory
usage.
In term of compilation time, on my 4 cpus laptop, I measured a 15sec
(20%) speedup over 10 runs when using all 4 cpus (make -j4).
On a larger machine (16 cpus), I measured 30sec (60%) speedup when using
all 16 cpus.
In term of memory usage, I was able to compile the project on a virtual
machine with 500MB of memory without hitting memory exhaustion errors.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I025a4c36ef16b935be2a86f5b6649526752a7393
Francis Deslauriers [Wed, 5 May 2021 16:37:44 +0000 (12:37 -0400)]
Include `linux/in{,6}.h` closer to where it's used
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5e2acc1cd081da131ae289506592e74de553133a
Francis Deslauriers [Wed, 5 May 2021 15:51:31 +0000 (11:51 -0400)]
Group all syscall enums in one compile unit
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic0189984d9bc70ae3f76af08bffd127500adad80
Francis Deslauriers [Wed, 5 May 2021 16:15:06 +0000 (12:15 -0400)]
Include `linux/mman.h` for mmap flag enum
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id891f59aef1bb26b1ed8dff676bbad0f6d9fb69e
Francis Deslauriers [Fri, 30 Apr 2021 14:42:31 +0000 (10:42 -0400)]
Add `struct trace_syscall_table`
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I72181800793e84f001e83caeea8d7b7ae9e8d07c
Francis Deslauriers [Tue, 4 May 2021 19:48:52 +0000 (15:48 -0400)]
Define `static_assert()` when not defined by kernel
This macro is useful for build-time assertions. It was added in kernel
v5.1. It uses the C11 _Static_assert macro that was implemented with gcc
4.6. There is support for the _Static_assert in all C modes, including
gnu89.
Since our minimal gcc version is 4.8, we can simply define it manually
if the kernel is older than v5.1.
Kernel commit adding this macro:
commit
6bab69c65013bed5fce9f101a64a84d0385b3946
Author: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Date: Thu Mar 7 16:27:00 2019 -0800
build_bug.h: add wrapper for _Static_assert
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5aa250f60f9dca4f13b8bcc093a006034c28e526
Mathieu Desnoyers [Mon, 3 May 2021 16:54:10 +0000 (12:54 -0400)]
Move event hash tables to private header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id4c690c275bace3dee92b5c3c25e09ac4eb3b384
Mathieu Desnoyers [Mon, 3 May 2021 16:52:51 +0000 (12:52 -0400)]
Move forward declarations to private header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ibd6fa4f9ec751be8cdb0082c729c3c5662c02d0b
Mathieu Desnoyers [Mon, 3 May 2021 16:51:39 +0000 (12:51 -0400)]
Move lttng_syscall_filter forward declaration to private header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ife15ca8d175e33e4282a1dd9fd3dc7e759163c8f
Mathieu Desnoyers [Mon, 3 May 2021 16:46:04 +0000 (12:46 -0400)]
Split ID tracker into public/private structures
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic17da38eb96d734110b59656d0fedce1bacd570a
Mathieu Desnoyers [Mon, 3 May 2021 16:22:15 +0000 (12:22 -0400)]
Move id tracker hash node to private header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0b0cdb345a24f72a17a84a48a5f28acca72441bb
Mathieu Desnoyers [Mon, 3 May 2021 15:46:40 +0000 (11:46 -0400)]
Split struct lttng_session into public/private structures
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3c8e5c826268659d78f4c177e846cc93727af1c2
Mathieu Desnoyers [Mon, 3 May 2021 15:31:55 +0000 (11:31 -0400)]
Move struct lttng_metadata_stream to private header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ieae3b2c4c2ffe50360a33db1056734d04668af82
Mathieu Desnoyers [Mon, 3 May 2021 15:30:52 +0000 (11:30 -0400)]
Move event notifier and counter structures to private header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I119a948c39edbe42e22a12d59e8908029d6acad0
Mathieu Desnoyers [Mon, 3 May 2021 15:23:44 +0000 (11:23 -0400)]
Rename struct lib_ring_buffer_ctx to struct lttng_kernel_ring_buffer_ctx
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I81c3ef6dd226f2a27a32b303a096f60927462615
Mathieu Desnoyers [Mon, 3 May 2021 15:14:39 +0000 (11:14 -0400)]
Refactoring: struct lttng_kernel_channel_buffer_ops
Introduce public/private structures for ring buffer channel operations.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3614d550615a4617541a292fa761bebbdf6a275a
Mathieu Desnoyers [Mon, 3 May 2021 14:56:48 +0000 (10:56 -0400)]
Rename lttng_probe_{,un}register to lttng_kernel_probe_{,un}register
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I62e1d4765d2dd8dcd4a40f3a12e40bbef93a2ead
Mathieu Desnoyers [Mon, 3 May 2021 14:54:37 +0000 (10:54 -0400)]
Move metadata cache structure to internal header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I99e77d8b6bc1b85dc324feecc81348aeab015030
Mathieu Desnoyers [Mon, 3 May 2021 14:52:58 +0000 (10:52 -0400)]
Move internal APIs to internal header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib8c8f64c00e26d49fa4ba2fdf5c85a7f8fdd2568
Mathieu Desnoyers [Mon, 3 May 2021 14:44:45 +0000 (10:44 -0400)]
Move kprobes, uprobes, kretprobes, syscall structures to internal header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id2d352182084cd50998df0a23dcab16d3e7212fc
Mathieu Desnoyers [Mon, 3 May 2021 14:41:45 +0000 (10:41 -0400)]
Move kprobe, kretprobe, uprobe APIs to internal header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I92c5a245c3e5f12b6d43b73e104a86e55e341817
Mathieu Desnoyers [Mon, 3 May 2021 14:40:41 +0000 (10:40 -0400)]
Remove unused TRACEPOINT_HAS_DATA_ARG
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib3af9240f9f995d7e9b6a76310ca8388e01f6c3d
Mathieu Desnoyers [Mon, 3 May 2021 14:39:32 +0000 (10:39 -0400)]
Move enabler APIs to internal header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Idd0eee625ab10b17a412a6d0d777d64f71801582
Mathieu Desnoyers [Mon, 3 May 2021 14:33:55 +0000 (10:33 -0400)]
Move bytecode structures to internal header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic7931b3fd6d8f4674f7e0a020a4501db4f3ae509
Mathieu Desnoyers [Mon, 3 May 2021 14:29:27 +0000 (10:29 -0400)]
Remove include of internal header from tracepoint-event-impl.h
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9b504b4d898a9b53c2d1262379fca3e63b7fef2b
Mathieu Desnoyers [Mon, 3 May 2021 14:27:18 +0000 (10:27 -0400)]
Rename struct lttng_probe_ctx to struct lttng_kernel_probe_ctx
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I629b7e447b9842ab863894abd08e4901b439ee17
Mathieu Desnoyers [Mon, 3 May 2021 14:24:48 +0000 (10:24 -0400)]
Rename struct lttng_bytecode_runtime to struct lttng_kernel_bytecode_runtime
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I14051998b44fde8aa94f72c227b89786d40ca4ff
Mathieu Desnoyers [Mon, 3 May 2021 14:18:58 +0000 (10:18 -0400)]
Rename struct lttng_bytecode_node to struct lttng_kernel_bytecode_node
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic00142968c7132d3a2b8292d426948dfbe1b0d88
Mathieu Desnoyers [Mon, 3 May 2021 14:15:22 +0000 (10:15 -0400)]
Move context structures and API to internal header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1a6cbb26efb8c9fd4b4ef1872dd39b764a1f473b
Mathieu Desnoyers [Mon, 3 May 2021 14:08:40 +0000 (10:08 -0400)]
Move enabler structures to internal header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0769e0ea730f5fbf306bce4f5527c81c193cdbe9
Francis Deslauriers [Fri, 30 Apr 2021 15:28:13 +0000 (11:28 -0400)]
Makefile: add .o wildcard target
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia421852ef9f778d79d810a36c45daaba27727efb
Francis Deslauriers [Fri, 30 Apr 2021 15:14:20 +0000 (11:14 -0400)]
Fix: Makefile: generation of specific .i file not working
Issue
=====
When trying to get the preprocessed version of the `lttng-syscalls.c` file
I get the following error:
$ make src/lttng-syscalls.i
make -C /lib/modules/5.4.0-67-generic/build M=/home/frdeso/projets/lttng/modules/src CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m src/lttng-syscalls.i
make[1]: Entering directory '/usr/src/linux-headers-5.4.0-67-generic'
make[3]: *** No rule to make target '/home/frdeso/projets/lttng/modules/src/src/lttng-syscalls.i'. Stop.
make[2]: *** [scripts/Makefile.build:480: __build] Error 2
make[1]: *** [Makefile:1760: /home/frdeso/projets/lttng/modules/src] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-67-generic'
make: *** [Makefile:32: src/lttng-syscalls.i] Error 2
We see that the gcc tries to create the `src/src/lttng-syscalls.i` file
instead of the expected `src/lttng-syscalls.i`.
Fix
===
Remove the `/src` from the `M=` option.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4403d32955723239649eb385f877e52cea669720
Mathieu Desnoyers [Thu, 29 Apr 2021 15:15:03 +0000 (11:15 -0400)]
Fix: refactor preemptible context
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia7dd34be0a55baf65bc2ce3981492c26a535c832
Mathieu Desnoyers [Wed, 28 Apr 2021 20:26:20 +0000 (16:26 -0400)]
Refactoring: context callbacks
Refactor the context callbacks so they take a private pointer as
argument.
Note that the callstack context internally uses a per-cpu stack across
context size calculation and recording to the ring buffer, which
requires that preemption is disabled across those operations.
The get_size_arg and _get_size callbacks are merged into a single
callback.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7c4146481d35cb9ddef19f2cb5d61e56ebe142be
Mathieu Desnoyers [Wed, 28 Apr 2021 19:30:04 +0000 (15:30 -0400)]
Remove event id parameter from event_reserve callback
This can be fetched from the event recorder.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I85a4ef493d67c1c374e7f3076569c2c2c2109953
Mathieu Desnoyers [Wed, 28 Apr 2021 18:56:05 +0000 (14:56 -0400)]
Refactoring: ring buffer context
Split the ring buffer context into:
- Public ring buffer context (initialized by probe),
- Private context (initialized by reserve callback),
Pass event recorder rather than channel as client_ctx for events
generated from instrumentation (calling ring buffer client).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iecd23f11c54da4ba58a97c46192f775a0a74bd85
Mathieu Desnoyers [Sat, 24 Apr 2021 00:29:27 +0000 (20:29 -0400)]
sequence and variant types: use previous field for length/tag if NULL
A common use-case for sequences and variants is to use the field located
immediately prior to the type as length/tag.
The fact that those types need to explicitly contain their length/tag
name ties the sequence/variant type to where it is placed within the
structure fields, preventing re-use of the sequence/variant type.
In order to reduce the memory footprint of the field descriptions and
allow re-use of common field types, special-case the NULL length name
and tag name to use the field prior to the sequence/variant as length.
This allows more efficient type descriptions without reducing the
overall flexibility of sequence/variant layout.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I27053e8541beb4f8f8226e411c71595f7527f533
Mathieu Desnoyers [Sat, 24 Apr 2021 01:13:26 +0000 (21:13 -0400)]
Version 2.13.0-rc1
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iebcfdc3cfd2ca16e59107ff7688850239c6a08e9
Mathieu Desnoyers [Sat, 24 Apr 2021 00:56:57 +0000 (20:56 -0400)]
Set the 2.13 release codename and description
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I53fbb76eaaac57710cb0bd348eab32fc3c2b93dd
Mathieu Desnoyers [Tue, 20 Apr 2021 15:05:19 +0000 (11:05 -0400)]
Fix: LTTng-modules ABI ioctl wrong direction
lttng-modules defines ioctl numbers (include/lttng/abi.h) using the
_IO*() macros. These macros are partly used to specify what type of
parameters that the ioctl will be expecting. It also specifies the
direction of the data flow.
1. sending data from userspace to the kernel,
2. sending data from the kernel to userspace,
3. both.
According to the kernel's
Documentation/userspace-api/ioctl/ioctl-number.rst file here is the
meaning of the various macros:
====== == ============================================
_IO an ioctl with no parameters
_IOW an ioctl with write parameters (copy_from_user)
_IOR an ioctl with read parameters (copy_to_user)
_IOWR an ioctl with both write and read parameters.
====== == ============================================
Some of our use of these macros are wrong. In some cases, we use _IOW()
when we should be using _IOR():
Here is a list of the ioctl numbers that should be _IOW() as they are
sending data to the kernel:
#define LTTNG_KERNEL_SESSION_TRACK_PID IOR(0xF6, 0x58, int32_t)
#define LTTNG_KERNEL_SESSION_UNTRACK_PID _IOR(0xF6, 0x59, int32_t)
#define LTTNG_KERNEL_SESSION_SET_NAME _IOR(0xF6, 0x5D, struct lttng_kernel_session_name)
#define LTTNG_KERNEL_SESSION_SET_CREATION_TIME _IOR(0xF6, 0x5E, struct lttng_kernel_session_creation_time)
#define LTTNG_KERNEL_SESSION_LIST_TRACKER_IDS _IOR(0xF6, 0xA0, struct lttng_kernel_tracker_args)
#define LTTNG_KERNEL_SESSION_TRACK_ID _IOR(0xF6, 0xA1, struct lttng_kernel_tracker_args)
#define LTTNG_KERNEL_SESSION_UNTRACK_ID _IOR(0xF6, 0xA2, struct lttng_kernel_tracker_args)
Fix this by changing the direction of the macros, but introduce "_OLD"
macros for backward compatibility.
User-space should gradually start interacting with the correct ioctl
direction. However, in order to preserve compatibility between newer
user-space tools and older lttng-modules, user-space should fall-back on
the "_OLD" ioctl directions if the new directions are not implemented by
an older lttng-modules.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I70d1963464597e0e3b028a67739d4a13b96c1ea5
Mathieu Desnoyers [Fri, 23 Apr 2021 00:37:14 +0000 (20:37 -0400)]
Refactoring: bytecode interpreter
Refactor bytecode interpreter to combine more code between filter and
capture interpreters.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic9fe054ef4cbbef578e1e2c396bdadce221b9c6f
Mathieu Desnoyers [Thu, 22 Apr 2021 21:49:54 +0000 (17:49 -0400)]
Move probe_ctx argument to align with lttng-ust
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If020f8a982ab66b7a041300b6dc11aa00ce803db
Mathieu Desnoyers [Thu, 22 Apr 2021 20:17:54 +0000 (16:17 -0400)]
Combine event notifier and recorder enable/disable functions
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I945b24211b48b9d40b1d25f0c9fb78f6eb8439da
Mathieu Desnoyers [Thu, 22 Apr 2021 17:52:43 +0000 (13:52 -0400)]
Refactoring: combine probe callbacks
Combine probe callbacks for event recorder and notifier. Also combine
the code for args vs noargs probes, shrinking the number of probe
implementations from 4 to 1.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic7c0494ffd171caca33cfd13a8a40771691d89b5
Mathieu Desnoyers [Thu, 22 Apr 2021 17:20:04 +0000 (13:20 -0400)]
Combine event recorder and notifier destroy
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8a7e18d98286ddc1bf132cd39039658c9b669f51
Mathieu Desnoyers [Thu, 15 Apr 2021 12:23:17 +0000 (08:23 -0400)]
Refactoring: event structures
Combine event recorder and event notifier structures common parts into a
"common" parent structure. Move "internal" fields not meant to be
touched by the probes into private structures.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1fd8fdb976664ff7cbdf6efdb0c51705682b8560
He Zhe [Mon, 19 Apr 2021 09:16:57 +0000 (09:16 +0000)]
lttng-probes: Warn of event's and provider's name for mismatch
We have experience serveral cases of such mismatches. To make it easier to
debug, let's warn users of the event's and the provide's name.
Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I455bf92f9f735f890753c9103d22986e56e02e5d
He Zhe [Mon, 19 Apr 2021 09:09:28 +0000 (09:09 +0000)]
fix: mm, tracing: kfree event name mismatching with provider kmem (v5.12)
a8bc8ae5c932 ("fix: mm, tracing: record slab name for kmem_cache_free() (v5.12)")
introduces the following call trace for kfree. This is caused by mismatch
between kfree event and its provider kmem.
This patch maps kfree to kmem_kfree.
WARNING: CPU: 2 PID: 42294 at src/lttng-probes.c:81 fixup_lazy_probes+0xb0/0x1b0 [lttng_tracer]
CPU: 2 PID: 42294 Comm: modprobe Tainted: G O 5.12.0-rc6-yoctodev-standard #1
Hardware name: Intel Corporation JACOBSVILLE/JACOBSVILLE, BIOS JBVLCRB2.86B.0014.P20.
2004020248 04/02/2020
RIP: 0010:fixup_lazy_probes+0xb0/0x1b0 [lttng_tracer]
Code: 75 28 83 c3 01 3b 5d c4 74 22 48 8b 4d d0 48 63
c3 4c 89 e2 4c 89 f6 48 8b 04 c1 4c 8b 38 4c 89
ff e8 64 9f 4b de 85 c0 74 c3 <0f> 0b 48 8b 05 bf
f2 1e 00 48 8d 50 e8 48 3d f0 a0 98 c0 75 18 eb
RSP: 0018:
ffffb976807bfbe0 EFLAGS:
00010286
RAX:
00000000ffffffff RBX:
0000000000000004 RCX:
0000000000000004
RDX:
0000000000000066 RSI:
ffffffffc03c10a7 RDI:
ffffffffc03c11a1
RBP:
ffffb976807bfc28 R08:
0000000000000000 R09:
0000000000000001
R10:
0000000000000001 R11:
0000000000000001 R12:
0000000000000004
R13:
ffffffffc03c2000 R14:
ffffffffc03c10a7 R15:
ffffffffc03c11a1
FS:
00007f0ef9533740(0000) GS:
ffffa100faa00000(0000) knlGS:
0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0:
0000000080050033
CR2:
0000561e8f0aa000 CR3:
000000015b318000 CR4:
0000000000350ee0
Call Trace:
lttng_probe_register+0x38/0xe0 [lttng_tracer]
? __event_probe__module_load+0x520/0x520 [lttng_probe_module]
__lttng_events_init__module+0x15/0x20 [lttng_probe_module]
do_one_initcall+0x68/0x310
? kmem_cache_alloc_trace+0x2ad/0x4c0
? do_init_module+0x28/0x280
do_init_module+0x62/0x280
load_module+0x26e4/0x2920
? kernel_read_file+0x22e/0x290
__do_sys_finit_module+0xb1/0xf0
__x64_sys_finit_module+0x1a/0x20
do_syscall_64+0x38/0x50
entry_SYSCALL_64_after_hwframe+0x44/0xae
Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I00e8ee2b8c35f6f8602c88295f5113fbbd139709
Michael Jeanson [Thu, 15 Apr 2021 15:29:06 +0000 (11:29 -0400)]
fix: refactor contexts for type description structures
The 'preemptible' and 'migratable' contexts were not refactored along
the others in :
commit
437d5aa59380583ce1cd14d394a53b398be1275d
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: Wed Apr 7 14:52:27 2021 -0400
Refactoring: type description structures
Change-Id: I8a228c0ff982a4aded27b055baae1f5efec29164
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 16 Feb 2021 21:51:47 +0000 (16:51 -0500)]
fix: remove 'src/' from modules install path
The move of the modules sources in the 'src/' subdirectory had the
unexpected side effect of adding 'src/' to the module install path
inside '/lib/modules/$(uname -r)/extra'. Adjust the Makefiles to return
to the initial behavior.
Change-Id: I280fe8a1e5ef367edeec0a6351351a233cc6f0be
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifcc64ea95c0e1435567150d976d42e3add3f7523
Michael Jeanson [Thu, 15 Apr 2021 14:53:21 +0000 (10:53 -0400)]
fix: Adjust ranges for Ubuntu 5.4.0-67 kernel
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifa0f50ffdc946d80b67bb5ae7ca4b0aa152e825b
Michael Jeanson [Mon, 15 Mar 2021 18:54:02 +0000 (14:54 -0400)]
fix: block: add a disk_uevent helper (v5.12)
See upstream commit:
commit
bc359d03c7ec1bf3b86d03bafaf6bbb21e6414fd
Author: Christoph Hellwig <hch@lst.de>
Date: Sun Jan 24 11:02:39 2021 +0100
block: add a disk_uevent helper
Add a helper to call kobject_uevent for the disk and all partitions, and
unexport the disk_part_iter_* helpers that are now only used in the core
block code.
Change-Id: If6e8797049642ab382d5699660ee1dd734e92c90
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 15 Apr 2021 13:39:30 +0000 (09:39 -0400)]
Fix: perf counters: uninitialized field
Reported by Coverity:
** CID
1452572: Uninitialized variables (UNINIT)
>>> Using uninitialized value "ctx_field". Field "ctx_field.get_size_arg" is uninitialized when calling "lttng_kernel_context_append".
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I064260c6fe78af24768bb141fde2864d2abbe3a5
Mathieu Desnoyers [Wed, 14 Apr 2021 19:02:10 +0000 (15:02 -0400)]
Cleanup: implement dedicated file operations for events and enablers
In order to simplify the code in preparation for refactoring of the
event structures, remove the "event type" field and implement specific
file operations for events and enablers.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I508bdb46fa3747112e7cfef4a62278fb566f842a
Mathieu Desnoyers [Wed, 14 Apr 2021 17:52:07 +0000 (13:52 -0400)]
Namespace LTTng modules ABI with lttng_kernel_abi_ prefix
Standardize on lttng_kernel_abi_ prefix for the lttng modules ABI to
eliminate namespace clash between lttng-modules core code and its ABI.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3b1c8d6f46702e57defa17d683ede576466ba3ce
Mathieu Desnoyers [Wed, 7 Apr 2021 18:52:27 +0000 (14:52 -0400)]
Refactoring: type description structures
Refactoring:
- Type description structures: new API based on structure inheritance
rather than union,
- Rely on compound literals,
- Rename description fields: name -> event_name,
- Rename types (lttng_kernel_ namespace):
- struct lttng_kernel_event_desc,
- struct lttng_kernel_event_field,
- struct lttng_kernel_ctx.
- Move some internal definitions (not used by probes) to
events-internal.h.
- Streamline context registration API,
- Introduce the LTTNG_CREATE_FIELD_METADATA define for the tracepoint
code generation pass which generates the type descriptions, allowing
to describe structures as an array of fields, and use enumerations
from those fields.
- Adapt all tracepoint instrumentation to those changes.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9a968a62888c52438a1f62ec24fcced4c3fd6ddf
Mathieu Desnoyers [Wed, 7 Apr 2021 18:02:09 +0000 (14:02 -0400)]
Prefix lttng_enum_desc with lttng_kernel_
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I25b7160875c99c99c18d1e559b09698b5411dae7
Mathieu Desnoyers [Wed, 7 Apr 2021 18:00:37 +0000 (14:00 -0400)]
Prefix lttng_enum_value and lttng_enum_entry with lttng_kernel_
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4b4d502e2af9a1ca6425889da2697c5633200f52
Mathieu Desnoyers [Wed, 7 Apr 2021 17:51:28 +0000 (13:51 -0400)]
Introduce internal event header
This header is to be included by the tracer, but not by tracepoint
probes.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic9501bb58c4156d3b037b4f15251d03e25cd45f9
Mathieu Desnoyers [Wed, 7 Apr 2021 17:47:03 +0000 (13:47 -0400)]
Cleanup: namespace string encoding
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic7265a6617feaacfe621d895cd0bc8ce2b50d912
Mathieu Desnoyers [Wed, 7 Apr 2021 17:40:46 +0000 (13:40 -0400)]
Cleanup: Rename abstract types to lttng_kernel_type
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iac1810c9d9830d80109fe72b1965b7b7cf663207
Mathieu Desnoyers [Wed, 7 Apr 2021 15:07:29 +0000 (11:07 -0400)]
Cleanup: event_notifier -> notify in comments
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icdb4282e8b5fce231f96c56b4568555bd7a442fb
Mathieu Desnoyers [Wed, 7 Apr 2021 15:05:32 +0000 (11:05 -0400)]
Fix: event notifier: add missing parameters validation
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Idbbbe369f64c14e7ac8914b4e7eb8e3ef75b1fb5
Mathieu Desnoyers [Fri, 9 Apr 2021 15:50:41 +0000 (11:50 -0400)]
msgpack: use KERNEL namespace for header protection
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8a3ee5bd935442dc5d3fcaff97859406279eb73d
Mathieu Desnoyers [Tue, 6 Apr 2021 20:21:54 +0000 (16:21 -0400)]
Cleanup: lttng_abi_create_event{,_notifier}: use switch/case rather than if
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2a5454521d57fdfcb0c623031b24d590aff40281
Mathieu Desnoyers [Tue, 6 Apr 2021 18:37:43 +0000 (14:37 -0400)]
Add entryexit field to kretprobes ABI
At this stage, only "entryexit = 0" is supported. No behavior change
except for validating that ENTRY and EXIT are unsupported (-EINVAL).
It is possible to extend struct lttng_kernel_kretprobe because it is
always used within struct lttng_kernel_event which contains enough
zero-initialized padding due to char padding[LTTNG_KERNEL_EVENT_PADDING2].
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I96d86eebff66da4af186ef51c2ff13e2ed84a510
Mathieu Desnoyers [Tue, 6 Apr 2021 18:35:25 +0000 (14:35 -0400)]
Add missing fallthrough comments
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I225a5236c108e5b0d4bd39b5f1ef6988fe8b0096
Mathieu Desnoyers [Tue, 6 Apr 2021 18:17:35 +0000 (14:17 -0400)]
No-op instrumentation is unsupported, cleanup fallthrough comments
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id76238ead464dda1b40c6006f26d76c8a1049698
Mathieu Desnoyers [Thu, 1 Apr 2021 20:10:09 +0000 (16:10 -0400)]
kretprobes: rename "return" to "exit"
The kretprobes instrumentation emits <func>_entry and <func>_return.
However, pairing "entry" and "return" is not semantically right. The
term "entry" should be paired with "exit" (similarly to system call
intrumentation), since "return" should be paired with "call".
If we look at what is actually instrumented by kretprobes, we indeed
instrument the entry and exit points of a function.
Therefore, change the "<func>_return" event for "<func>_exit".
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia541253cbb65a5afc8aaed2a6cfa77d9b296c96c
Mathieu Desnoyers [Thu, 25 Mar 2021 18:20:58 +0000 (14:20 -0400)]
compiler warning cleanup: is_signed_type: compare -1 to 1
Comparing -1 to 0 triggers compiler warnings (gcc -Wtype-limits and
-Wbool-compare) and Coverity warning "Macro compares unsigned to 0".
Comparing -1 to 1 instead takes care of silencing those warnings while
keeping the same behavior.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id42a51759a1c7c669e63588c05f9d4485304c541
Mathieu Desnoyers [Mon, 22 Mar 2021 17:33:54 +0000 (13:33 -0400)]
Fix: bytecode linker: validate event and field array/sequence encoding
The bytecode linker should only allow linking filter expressions loading
fields which are string-encoded arrays and sequence for comparison
against a string, and reject arrays and sequences without encoding, so
the filter interpreter does not attempt to load non-NULL terminated
arrays/sequences as if they were strings.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia5f33ed036e310d66aee6b682ef0a17eb5b99982
Mathieu Desnoyers [Fri, 19 Mar 2021 15:27:50 +0000 (11:27 -0400)]
Fix: racy notifier captures update vs traversal
For captures, a new struct lttng_kernel_notification_ctx is introduced,
which is to be used as additional "context" to the notification_send()
callback. This allows passing the "eval_capture" state from the probe
to the notification callback, and fixes a bug where a sequence of:
- create notification enabler,
- enable notification enabler,
- add capture to enabler,
where a tracepoint runs concurrently with add capture happens to do a
first capture list_empty check which skips the stack preparation,
whereas the second capture list_empty check within the notification
callback finds a capture entry, and thus attempts to use an
uninitialized stack. The notification callback is also modified to use
an RCU-aware list traversal.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib7ab673fb05b4824d0c7ba2e163dc1e88b465ee9
Francis Deslauriers [Wed, 17 Mar 2021 14:40:56 +0000 (10:40 -0400)]
Fix: kretprobe: null ptr deref on session destroy
The `filter_bytecode_runtime_head` list is currently not initialized for
the return event of the kretprobe. This caused a kernel null ptr
dereference when destroying a session. It can reproduced with the
following commands:
lttng create
lttng enable-event -k --function=lttng_test_filter_event_write my_event
lttng start
lttng stop
lttng destroy
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1162ce8b10dd7237a26331531f048346b984eee7
Mathieu Desnoyers [Fri, 12 Mar 2021 14:36:46 +0000 (09:36 -0500)]
Fix: bytecode linker: iteration on wrong list head
lttng_enabler_link_bytecode() calls link_bytecode() passing an insertion
location (insert_loc) within the list. This insert location is meant to
be used as cursor position where to add the new element.
However, bytecode_is_linked() uses it as iteration list head, and this
is where things fall apart: it will thus consider the real list head as
being a list node, and will erroneously think that it is contained
within a struct lttng_bytecode_runtime, and thus try to perform possibly
out-of-bound read or read garbage data for the comparison.
It worked fine most of the time because in usual scenarios the insert
location is the list head. It falls apart when many bytecodes are linked
to a given event.
Fixes: 2dfda770cc6 ("Decouple `struct lttng_event` from filter code")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7463c7a9399b8f7f7d0e3d74e6427aae46cf56ff
Mathieu Desnoyers [Wed, 10 Mar 2021 21:23:13 +0000 (16:23 -0500)]
counters: add coalesce_hits to ABI
This will be required by an upcoming feature in a subsequent release, so
plan ahead with a coalesce_hits field. It is currently unused by
lttng-modules.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0dd3a5c00a89c59111b723db8e39390a16764133
Michael Jeanson [Thu, 4 Mar 2021 21:50:12 +0000 (16:50 -0500)]
fix: mm, tracing: record slab name for kmem_cache_free() (v5.12)
See upstream commit:
commit
3544de8ee6e4817278b15fe08658de49abf58954
Author: Jacob Wen <jian.w.wen@oracle.com>
Date: Wed Feb 24 12:00:55 2021 -0800
mm, tracing: record slab name for kmem_cache_free()
Currently, a trace record generated by the RCU core is as below.
... kmem_cache_free: call_site=rcu_core+0x1fd/0x610 ptr=
00000000f3b49a66
It doesn't tell us what the RCU core has freed.
This patch adds the slab name to trace_kmem_cache_free().
The new format is as follows.
... kmem_cache_free: call_site=rcu_core+0x1fd/0x610 ptr=
0000000037f79c8d name=dentry
... kmem_cache_free: call_site=rcu_core+0x1fd/0x610 ptr=
00000000f78cb7b5 name=sock_inode_cache
... kmem_cache_free: call_site=rcu_core+0x1fd/0x610 ptr=
0000000018768985 name=pool_workqueue
... kmem_cache_free: call_site=rcu_core+0x1fd/0x610 ptr=
000000006a6cb484 name=radix_tree_node
We can use it to understand what the RCU core is going to free. For
example, some users maybe interested in when the RCU core starts
freeing reclaimable slabs like dentry to reduce memory pressure.
Link: https://lkml.kernel.org/r/20201216072804.8838-1-jian.w.wen@oracle.com
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1ee2fc476614cadcc8d3ac5d8feddc7910e1aa3a
Jérémie Galarneau [Wed, 3 Mar 2021 23:52:19 +0000 (18:52 -0500)]
Fix: filter interpreter early-exits on uninitialized value
I observed that syscall filtering on string arguments wouldn't work on
my development machines, both running 5.11.2-arch1-1 (Arch Linux).
For instance, enabling the tracing of the `openat()` syscall with the
'filename == "/proc/cpuinfo"' filter would not produce events even
though matching events were present in another session that had no
filtering active. The same problem occurred with `execve()`.
I tried a couple of kernel versions before (5.11.1 and 5.10.13, if
memory serves me well) and I had the same problem. Meanwhile, I couldn't
reproduce the problem on various Debian machines (the LTTng CI) nor on a
fresh Ubuntu 20.04 with both the stock kernel and with an updated 5.11.2
kernel.
I built the lttng-modules with the interpreter debugging printout and
saw the following warning:
LTTng: [debug bytecode in /home/jgalar/EfficiOS/src/lttng-modules/src/lttng-bytecode-interpreter.c:bytecode_interpret@1508] Bytecode warning: loading a NULL string.
After a shedload (yes, a _shed_load) of digging, I figured that the
problem was hidden in plain sight near that logging statement.
In the `BYTECODE_OP_LOAD_FIELD_REF_USER_STRING` operation, the 'ax'
register's 'user_str' is initialized with the stack value (the user
space string's address in our case). However, a NULL check is performed
against the register's 'str' member.
I initialy suspected that both members would be part of the same union
and alias each-other, but they are actually contiguous in a structure.
On the unaffected machines, I could confirm that the `str` member was
uninitialized to a non-zero value causing the condition to evaluate to
false.
Francis Deslauriers reproduced the problem by initializing the
interpreter stack to zero.
I am unsure of the exact kernel configuration option that reveals this
issue on Arch Linux, but my kernel has the following option enabled:
CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL:
Zero-initialize any stack variables that may be passed by reference
and had not already been explicitly initialized. This is intended to
eliminate all classes of uninitialized stack variable exploits and
information exposures.
I have not tried to build without this enabled as, anyhow, this seems
to be a legitimate issue.
I have spotted what appears to be an identical problem in
`BYTECODE_OP_LOAD_FIELD_REF_USER_SEQUENCE` and corrected it. However,
I have not exercised that code path.
The commit that introduced this problem is
5b4ad89.
The debug print-out of the `BYTECODE_OP_LOAD_FIELD_REF_USER_STRING`
operation is modified to print the user string (truncated to 31 chars).
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2da3c31b9e3ce0e1b164cf3d2711c0893cbec273
Mathieu Desnoyers [Wed, 3 Mar 2021 15:22:38 +0000 (10:22 -0500)]
Fix: memory leaks on event notifier destroy
Both filter runtime and event enabler ref objects are owned by the
event notifier, but are not freed upon destruction of the event notifier
object, thus leaking memory.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I511569f56a38f670549a93cb6179b77861245712
Mathieu Desnoyers [Wed, 3 Mar 2021 15:10:16 +0000 (10:10 -0500)]
Fix: memory leaks on event destroy
Both filter runtime and event enabler ref objects are owned by the
event, but are not freed upon destruction of the event object, thus
leaking memory.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ice9b1c18b47584838aea2b965494d3c8391f4c84
Michael Jeanson [Tue, 16 Feb 2021 23:08:19 +0000 (18:08 -0500)]
fix: Adjust ranges for Ubuntu 5.8.0-44 kernel
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I419904dc9da316b38c2c16a08b6c17625b19b305
Mathieu Desnoyers [Wed, 10 Feb 2021 17:33:38 +0000 (12:33 -0500)]
Fix: do not use bdi_unknown_name symbol
Use the GPL-exported bdi_dev_name introduced in kernel 5.7. Do not use
static inline bdi_dev_name in prior kernels because it uses the bdi_unknown_name
symbol which is not exported to GPL modules.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8b4e4fd84ecacef7942b308e615ca88db8dce7b6
Mathieu Desnoyers [Wed, 10 Feb 2021 16:45:42 +0000 (11:45 -0500)]
fix: memcg: fix a crash in wb_workfn when a device disappears (5.6)
See upstream commit:
commit
68f23b89067fdf187763e75a56087550624fdbee
("memcg: fix a crash in wb_workfn when a device disappears")
It is currently backported into stable branches 5.4 and 5.5, but appears
to be missing from the 4.4, 4.9, 4.14, 4.19 LTS branches.
Implement our own lttng_bdi_dev_name wrapper to provide this fix on
builds against stable kernels which do not have this fix.
There is one user-visible change with this commit: for builds against
kernels < 4.4.0, the writeback_work_class events did use the
default_backing_dev_info to handle cases where the device is NULL,
writing "default" into the trace. This behavior is now aligned to
match what is done in kernels >= 4.4.0, which is to write "(unknown)"
into the name field.
Link: https://lore.kernel.org/r/537870616.15400.1612973059419.JavaMail.zimbra@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0823643aa2f9d4c2b9f2005748a2adfd4457979a
Mathieu Desnoyers [Fri, 5 Feb 2021 21:21:47 +0000 (16:21 -0500)]
Fix: writeback: out-of-bound reads
Use ctf_string rather than ctf_array_text for name fields, because the
source strings are not guaranteed to be at least 32 bytes.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 9 Feb 2021 16:28:27 +0000 (11:28 -0500)]
fix: Add one digit to RHEL major release version
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4e8b10ee985db59f7795e026486b3d47b76b5728
Michael Jeanson [Tue, 9 Feb 2021 16:25:57 +0000 (11:25 -0500)]
fix: Add one digit to SLES minor release version
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia4b67b38377bdd997b754b92b09b96934940a013
Michael Jeanson [Mon, 8 Feb 2021 20:32:47 +0000 (15:32 -0500)]
fix: RT_PATCH_VERSION is close to overflow
We allocated only 8bits for RT_PATCH_VERSION in LTTNG_RT_VERSION_CODE,
the current RT patch version for the 4.4 branch is currently 214 which
is getting close to 256. Bump it to 16bits to avoid breakage in the
future.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0666bbe996854696ac98e025eb02e5fced0540b1
Michael Jeanson [Tue, 9 Feb 2021 16:04:25 +0000 (11:04 -0500)]
fix: cast LTTNG_KERNEL_VERSION/LTTNG_LINUX_VERSION_CODE to uint64_t
Cast our version macros to an unsigned 64bits value to prevent
overflowing when we append distro specific version information.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia42a5dc0dfddf64515aea144283af5cc0c3b97e0
Michael Jeanson [Tue, 9 Feb 2021 15:53:34 +0000 (10:53 -0500)]
fix: double defined LTTNG_KERNEL_VERSION
Cleanup a rebase error which resulted in double defined macros.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id9ddce968c0d142c2c1013e0f51f649caa23ee4c
Michael Jeanson [Fri, 5 Feb 2021 20:21:55 +0000 (15:21 -0500)]
fix: UTS_UBUNTU_RELEASE_ABI is close to overflow
We allocated only 8bits for UTS_UBUNTU_RELEASE_ABI in
LTTNG_UBUNTU_KERNEL_VERSION, the current Xenial kernel has an ABI of 207
which is getting close to 256. Bump it to 16bits to avoid breakage in
the future.
Change-Id: Iee99757bb28cdd958b044b31df3232b9f8816873
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Fri, 5 Feb 2021 17:08:40 +0000 (12:08 -0500)]
fix: sublevel version overflow in LINUX_VERSION_CODE
The 4.4.256 and 4.9.256 stable release overflow the 8bits allocated to
the sublevel in LINUX_VERSION_CODE which ends means they report
themselves as 4.5.0 and 4.10.0 respectively. The next releases in these
stables branches will have sublevel clamped at 255 and will thus report
themselves as 4.4.255 and 4.9.255 for all subsequent releases.
We need a way to way to properly detect these release since I doubt they
will stop breaking tracepoints declarations. As a workaround, extract
the version information from the Makefile in the kernel headers and use
this information to generate a version code when the sublevel is equal
or greater than 256.
Change-Id: I96ae9f22c0c1ba8c619643946a5311c767fbcf8c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Fri, 5 Feb 2021 19:31:51 +0000 (14:31 -0500)]
Namespace kernel version macros
This patch replaces all uses of the LINUX_VERSION_CODE and
KERNEL_VERSION macros by an 'LTTNG_' prefixed version, this will allow
us to override them.
Change-Id: If8fab7fe341dd35e2211d30427519a48dfb708f9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 22 Jan 2021 20:25:47 +0000 (15:25 -0500)]
aarch64: blacklist gcc prior to 5.1
Linux aarch64 requires GCC 5.1 or better because prior versions perform
unsafe access to deallocated stack.
Some Linux distributions may have backported the fix, but it was never
released into earlier upstream gcc versions.
Link: https://lwn.net/Articles/842122/
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I72993e446f7f54f39d0f360273b68f194be8c13a
This page took 0.048177 seconds and 4 git commands to generate.