lttng-modules.git
23 months agoBuild fix: arm64: incomplete landlock_rule_type type
Jérémie Galarneau [Tue, 13 Dec 2022 17:32:30 +0000 (12:32 -0500)] 
Build fix: arm64: incomplete landlock_rule_type type

While building the arm32 compatibility syscall instrumentation for
arm64, the build fails because types related to `landlock` are unknown.

Fixes:

/root/lttng-modules/src/../include/instrumentation/syscalls/headers/arm-32-syscalls_pointers.h:1428:138: error: conversion to incomplete type
 1428 |  TP_FIELDS(sc_exit(ctf_integer(long, ret, ret)) sc_inout(ctf_integer(const int, ruleset_fd, ruleset_fd)) sc_inout(ctf_integer(const enum landlock_rule_type, rule
_type, rule_type)) sc_inout(ctf_integer(const void *const, rule_attr, rule_attr)) sc_inout(ctf_integer(const __u32, flags, flags)))

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id898958b33ec241be792a731560f227917e35010

23 months agoFix: define old_sigaction as compat_old_sigaction in arm32 compat
Jérémie Galarneau [Tue, 13 Dec 2022 17:32:06 +0000 (12:32 -0500)] 
Fix: define old_sigaction as compat_old_sigaction in arm32 compat

In a follow-up patch which updates the instrumentation for arm32, the
instrumentation of the old_sigaction() syscall would fail to build when
targeting a 64-bit kernel.

In that context, old_sigaction becomes compat_old_sigaction which is a
syscall that can be disabled (it was superseded by rt_sigaction a long
time ago).

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3d9e155f7943cc4b768e13ebd25b671e46df9659

23 months agoFix: in_x32_syscall was introduced in v4.7.0
Mathieu Desnoyers [Thu, 1 Dec 2022 16:33:20 +0000 (11:33 -0500)] 
Fix: in_x32_syscall was introduced in v4.7.0

Prior to v4.7.0, is_x32_task() was the API to query whether the current
system call is following the x32 ABI.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I783bd3bb46ec5e863ae209f79cee2f1bb415e661

23 months agoExplicitly skip tracing x32 system calls
Mathieu Desnoyers [Wed, 30 Nov 2022 20:41:02 +0000 (15:41 -0500)] 
Explicitly skip tracing x32 system calls

x86 x32 system calls are not supported by LTTng. They are currently not
traced simply because their system call number is beyond the range of
NR_compat_syscalls.

However, this mostly happens by accident rather than by design.

Enforce this with an explicit check for in_x32_syscall(), which clearly
documents that those are not supported.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1235c32c5cf03612bf9c36785cf7c4f8f49d292b

23 months agofix: kallsyms wrapper on ppc64el
Michael Jeanson [Thu, 24 Nov 2022 19:25:33 +0000 (14:25 -0500)] 
fix: kallsyms wrapper on ppc64el

The 'PPC64_ELF_ABI_v2' macro in 'asm/types.h' was removed in v5.19 and
replaced by a config option 'CONFIG_PPC64_ELF_ABI_V2'.

See upstream commit :

  commit 5b89492c03e5c0a2c259b97d7d4c1bb9b02860aa
  Author: Christophe Leroy <christophe.leroy@csgroup.eu>
  Date:   Mon May 9 07:36:08 2022 +0200

    powerpc: Finalise cleanup around ABI use

    Now that we have CONFIG_PPC64_ELF_ABI_V1 and CONFIG_PPC64_ELF_ABI_V2,
    get rid of all indirect detection of ABI version.

Link: https://lore.kernel.org/r/709d9d69523c14c8a9fba4486395dca0f2d675b1.1652074503.git.christophe.leroy@csgroup.eu
Change-Id: Ibd00e35cab5516a6224bdfa5a6b540119b42dc55
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoFix: don't build 64-bit counter client on 32-bit arch
Michael Jeanson [Mon, 21 Nov 2022 19:45:24 +0000 (14:45 -0500)] 
Fix: don't build 64-bit counter client on 32-bit arch

A typo in the Makefile resulted in the 64-bit counter client being built
regardless of the bitness of the architecture.

Change-Id: Icde0f15485ace2f3a7935c1e333dc0abd378b610
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoRemove obsolete -ckt debian kernel version support
Michael Jeanson [Mon, 21 Nov 2022 18:50:43 +0000 (13:50 -0500)] 
Remove obsolete -ckt debian kernel version support

Change-Id: I71ee764a0e6371dea6265d44d4056385335b717c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoCleanup duplicated include in wrapper/timer.h
Michael Jeanson [Mon, 21 Nov 2022 18:38:52 +0000 (13:38 -0500)] 
Cleanup duplicated include in wrapper/timer.h

Change-Id: I7a2682d4a584954118fc110a1e374a107c4361ab
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from writeback instrumentation
Michael Jeanson [Mon, 21 Nov 2022 17:28:17 +0000 (12:28 -0500)] 
Drop support for kernels < 4.4 from writeback instrumentation

Change-Id: I92959e40f44371fad4a857f57726e243fb2920dd
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from workqueue instrumentation
Michael Jeanson [Mon, 21 Nov 2022 17:23:34 +0000 (12:23 -0500)] 
Drop support for kernels < 4.4 from workqueue instrumentation

Change-Id: Ic1e7a4a7516d2091093b726aa351c1ac2ff3ec0a
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from timer instrumentation
Michael Jeanson [Mon, 21 Nov 2022 17:22:40 +0000 (12:22 -0500)] 
Drop support for kernels < 4.4 from timer instrumentation

Change-Id: I17bbdaf79a548d0b9f3247a705c44a753c19b26b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from scsi instrumentation
Michael Jeanson [Mon, 21 Nov 2022 17:21:11 +0000 (12:21 -0500)] 
Drop support for kernels < 4.4 from scsi instrumentation

Change-Id: I714da0df56c0101dd6a05c19477c0658f18de053
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from sched instrumentation
Michael Jeanson [Mon, 21 Nov 2022 17:18:45 +0000 (12:18 -0500)] 
Drop support for kernels < 4.4 from sched instrumentation

Change-Id: I14e8ceb3ed5dedb294dbbfecce454cd05d3417b8
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from rpc instrumentation
Michael Jeanson [Mon, 21 Nov 2022 17:14:57 +0000 (12:14 -0500)] 
Drop support for kernels < 4.4 from rpc instrumentation

Change-Id: I972d7b1397faacf901f43783fb0375a2e1c6a8f1
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from rcu instrumentation
Michael Jeanson [Mon, 21 Nov 2022 17:12:40 +0000 (12:12 -0500)] 
Drop support for kernels < 4.4 from rcu instrumentation

Change-Id: I4c1aabf233f4f8ccfdd6c93469c10efe79507cd8
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from random instrumentation
Michael Jeanson [Mon, 21 Nov 2022 17:05:12 +0000 (12:05 -0500)] 
Drop support for kernels < 4.4 from random instrumentation

Change-Id: I6f314c2ceb86e72ebad35089169885161cda30de
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from printk instrumentation
Michael Jeanson [Mon, 21 Nov 2022 17:03:16 +0000 (12:03 -0500)] 
Drop support for kernels < 4.4 from printk instrumentation

Change-Id: Ibb707f10a386fba1971081d380c46da247bf688f
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from power instrumentation
Michael Jeanson [Mon, 21 Nov 2022 17:02:09 +0000 (12:02 -0500)] 
Drop support for kernels < 4.4 from power instrumentation

Change-Id: I775b227042965a946d5ff1f42d2b350eae044742
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from net instrumentation
Michael Jeanson [Mon, 21 Nov 2022 17:01:13 +0000 (12:01 -0500)] 
Drop support for kernels < 4.4 from net instrumentation

Change-Id: I0fdf030897f01eec18931e416a2cfe241c780795
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from module instrumentation
Michael Jeanson [Mon, 21 Nov 2022 17:00:15 +0000 (12:00 -0500)] 
Drop support for kernels < 4.4 from module instrumentation

Change-Id: Idcd0cd197272d2efbd511c05afff6240b72740ae
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from mm_vmscan instrumentation
Michael Jeanson [Mon, 21 Nov 2022 16:58:56 +0000 (11:58 -0500)] 
Drop support for kernels < 4.4 from mm_vmscan instrumentation

Change-Id: If1fa6ff0239241b4039bb8ad8d7ed38072079032
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from lttng-statedump instrumentation
Michael Jeanson [Mon, 21 Nov 2022 16:54:30 +0000 (11:54 -0500)] 
Drop support for kernels < 4.4 from lttng-statedump instrumentation

Change-Id: I70f8b7da3355f29c206d691b48bf801f3103a527
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from kmem instrumentation
Michael Jeanson [Mon, 21 Nov 2022 16:52:05 +0000 (11:52 -0500)] 
Drop support for kernels < 4.4 from kmem instrumentation

Change-Id: I83541b99c0e1960cb5b8e4df69a46ed8e0ee7ee9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from jbd instrumentation
Michael Jeanson [Mon, 21 Nov 2022 16:50:36 +0000 (11:50 -0500)] 
Drop support for kernels < 4.4 from jbd instrumentation

Change-Id: I881e5fb26808ffb903748ab72554fddd8bdbec55
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from jbd2 instrumentation
Michael Jeanson [Mon, 21 Nov 2022 16:49:45 +0000 (11:49 -0500)] 
Drop support for kernels < 4.4 from jbd2 instrumentation

Change-Id: Ia954795f4a5cc4d718eec70b4e6d9919e32bbf27
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from ext4 instrumentation
Michael Jeanson [Mon, 21 Nov 2022 16:48:00 +0000 (11:48 -0500)] 
Drop support for kernels < 4.4 from ext4 instrumentation

Change-Id: I4b9635ad3519e080db77020979aeba25cb01d892
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from compaction instrumentation
Michael Jeanson [Mon, 21 Nov 2022 16:39:21 +0000 (11:39 -0500)] 
Drop support for kernels < 4.4 from compaction instrumentation

Change-Id: Ic9305d3860ff3951f08e15e25d2a2f2bd0ef7913
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from btrfs instrumentation
Michael Jeanson [Mon, 21 Nov 2022 16:37:39 +0000 (11:37 -0500)] 
Drop support for kernels < 4.4 from btrfs instrumentation

Change-Id: Ib54ad6745ba214cb7f9829ca75a2685145985441
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from block instrumentation
Michael Jeanson [Mon, 21 Nov 2022 16:31:06 +0000 (11:31 -0500)] 
Drop support for kernels < 4.4 from block instrumentation

Change-Id: I8b0ae2055fabf21274221d0a25a11615c34fbc22
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from asoc instrumentation
Michael Jeanson [Fri, 18 Nov 2022 23:18:28 +0000 (18:18 -0500)] 
Drop support for kernels < 4.4 from asoc instrumentation

Change-Id: Ie0ba36a8aaa9106a17e5819767ab3fdee5cdd260
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from kvm instrumentation
Michael Jeanson [Fri, 18 Nov 2022 23:14:46 +0000 (18:14 -0500)] 
Drop support for kernels < 4.4 from kvm instrumentation

Change-Id: I01297f0e1b3e0e1121f8b7222059ef32e634d137
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
23 months agoDrop support for kernels < 4.4 from LTTng tracer core
Michael Jeanson [Fri, 18 Nov 2022 22:49:02 +0000 (17:49 -0500)] 
Drop support for kernels < 4.4 from LTTng tracer core

Change-Id: I16a57b7d7361d902b18de38faa33943430dedb97
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
23 months agoDrop support for kernels < 4.4 from ext3 and kvm probes
Michael Jeanson [Fri, 18 Nov 2022 22:38:49 +0000 (17:38 -0500)] 
Drop support for kernels < 4.4 from ext3 and kvm probes

This effectively removes the ext3 probe.

Change-Id: I77480103b4ef1f8d29e792a4f2d27e162d1fa94d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from perf counters context
Michael Jeanson [Fri, 18 Nov 2022 22:18:26 +0000 (17:18 -0500)] 
Drop support for kernels < 4.4 from perf counters context

Change-Id: I6b839954b0d9bacc81e4d943bfe1d32471ba9962
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from ns contexts
Michael Jeanson [Fri, 18 Nov 2022 22:15:27 +0000 (17:15 -0500)] 
Drop support for kernels < 4.4 from ns contexts

Change-Id: Ie10299af93193415adfafeccb1c59c4b8c0a0bc0
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from 'wrapper/splice.h'
Michael Jeanson [Fri, 18 Nov 2022 22:00:31 +0000 (17:00 -0500)] 
Drop support for kernels < 4.4 from 'wrapper/splice.h'

Change-Id: I7dfcb85e2d0195fd21523646cbdf938f526a3c1e
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from 'wrapper/irqdesc.h'
Michael Jeanson [Fri, 18 Nov 2022 21:55:55 +0000 (16:55 -0500)] 
Drop support for kernels < 4.4 from 'wrapper/irqdesc.h'

Change-Id: I29331b3cef4e59b6d5d34d869374dc8ed92a010d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from 'wrapper/writeback.h'
Michael Jeanson [Fri, 18 Nov 2022 21:50:59 +0000 (16:50 -0500)] 
Drop support for kernels < 4.4 from 'wrapper/writeback.h'

Change-Id: Ie9589e8eee3ca74694dd0671e4eb5dbb53882225
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from 'wrapper/vmalloc.h'
Michael Jeanson [Fri, 18 Nov 2022 21:48:32 +0000 (16:48 -0500)] 
Drop support for kernels < 4.4 from 'wrapper/vmalloc.h'

Change-Id: I4191d7b2899e8ebf754ce03566cc87220557742e
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from 'wrapper/tracepoint.h'
Michael Jeanson [Fri, 18 Nov 2022 21:42:38 +0000 (16:42 -0500)] 
Drop support for kernels < 4.4 from 'wrapper/tracepoint.h'

Change-Id: Icab9656bc3d9d22d9887191af2f7f465323c5c2a
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from 'wrapper/trace-clock.h'
Michael Jeanson [Fri, 18 Nov 2022 21:37:22 +0000 (16:37 -0500)] 
Drop support for kernels < 4.4 from 'wrapper/trace-clock.h'

Change-Id: I252af5b4e7948e4798ad9f70a57ac42a62d506ef
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from 'wrapper/page_alloc.h'
Michael Jeanson [Fri, 18 Nov 2022 21:34:33 +0000 (16:34 -0500)] 
Drop support for kernels < 4.4 from 'wrapper/page_alloc.h'

Change-Id: I1a702b78a5293ce631a7955fe67145fdf7445cb6
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from 'wrapper/mm.h'
Michael Jeanson [Fri, 18 Nov 2022 21:28:56 +0000 (16:28 -0500)] 
Drop support for kernels < 4.4 from 'wrapper/mm.h'

Change-Id: I9bdbecf08654d699f8f45fbc7ba862b1fbd822eb
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop support for kernels < 4.4 from 'wrapper/fdtable.h'
Michael Jeanson [Fri, 18 Nov 2022 21:26:21 +0000 (16:26 -0500)] 
Drop support for kernels < 4.4 from 'wrapper/fdtable.h'

Change-Id: Ib398db572d18c9ad3d08a5f21fe9285261fae0d1
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop 'linux/user_namespace.h' wrapper
Michael Jeanson [Fri, 18 Nov 2022 20:59:56 +0000 (15:59 -0500)] 
Drop 'linux/user_namespace.h' wrapper

Change-Id: I38bb6ff741126e18a4a1deb59471adb68dacdcb0
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop 'linux/uprobes.h' wrapper
Michael Jeanson [Fri, 18 Nov 2022 17:34:26 +0000 (12:34 -0500)] 
Drop 'linux/uprobes.h' wrapper

Change-Id: I6870122c24a9b8cb3cf8c5c0c75a78c2ec96f32b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop 'wrapper/time.h' wrapper
Michael Jeanson [Fri, 18 Nov 2022 17:30:39 +0000 (12:30 -0500)] 
Drop 'wrapper/time.h' wrapper

Change-Id: I15ae7f5436e5fc2dfa2b0f9b878810a07fe8a5e9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop 'linux/perf_events.h' wrapper
Michael Jeanson [Fri, 18 Nov 2022 17:27:19 +0000 (12:27 -0500)] 
Drop 'linux/perf_events.h' wrapper

Change-Id: Id4be9d9fbb70aa8213b12b2073a847cb81238993
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop 'linux/percpu-defs.h' wrapper
Michael Jeanson [Fri, 18 Nov 2022 17:25:25 +0000 (12:25 -0500)] 
Drop 'linux/percpu-defs.h' wrapper

Change-Id: Ie9fb775602f78fc205d0b2a3b9adeb2874eab8fc
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop 'wrapper/namespace.h' wrapper
Michael Jeanson [Fri, 18 Nov 2022 17:07:09 +0000 (12:07 -0500)] 
Drop 'wrapper/namespace.h' wrapper

Change-Id: Ib7ff96f36310cdcbe29fed279ab4a03ca96195e8
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop 'linux/irq.h' wrapper
Michael Jeanson [Fri, 18 Nov 2022 16:57:22 +0000 (11:57 -0500)] 
Drop 'linux/irq.h' wrapper

Change-Id: Idaebcb77e3cad262661385234fba284fa03676a9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop 'linux/file.h' wrapper
Michael Jeanson [Fri, 18 Nov 2022 16:52:46 +0000 (11:52 -0500)] 
Drop 'linux/file.h' wrapper

Change-Id: I1f4e0630be4af0f8af98655c7771974f41d73517
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop 'asm/barrier.h' wrapper
Michael Jeanson [Fri, 18 Nov 2022 16:47:53 +0000 (11:47 -0500)] 
Drop 'asm/barrier.h' wrapper

Change-Id: I2901758329083bceabcf2cb6f4a3ffae7fa87df7
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoDrop 'linux/atomic.h' wrapper
Michael Jeanson [Fri, 18 Nov 2022 16:42:33 +0000 (11:42 -0500)] 
Drop 'linux/atomic.h' wrapper

Change-Id: Ia4341ded38739dbdd7db5fcd4b5bc192b2150c11
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23 months agoSet kernel baseline to v4.4
Michael Jeanson [Fri, 18 Nov 2022 19:36:53 +0000 (14:36 -0500)] 
Set kernel baseline to v4.4

Change-Id: Ic1b6596b1c49e57660538322ec9dbbc84ee9a036
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoFix: Use ifdef for CONFIG_COMPAT_OLD_SIGACTION
Mathieu Desnoyers [Fri, 18 Nov 2022 15:31:32 +0000 (10:31 -0500)] 
Fix: Use ifdef for CONFIG_COMPAT_OLD_SIGACTION

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7ad6e10b134b328293013ca11474cfff58dbc559

2 years agoFix: system call instrumentation build failure on v3.0-v3.10 RT kernel
Mathieu Desnoyers [Fri, 18 Nov 2022 15:01:53 +0000 (10:01 -0500)] 
Fix: system call instrumentation build failure on v3.0-v3.10 RT kernel

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3f6f8e428c226b950138208f88a46015d843d2f9

2 years agoFix: add missing typedef and forward declarations for old kernels
Mathieu Desnoyers [Thu, 17 Nov 2022 20:28:12 +0000 (15:28 -0500)] 
Fix: add missing typedef and forward declarations for old kernels

While we are updating this, remove duplicated code between header and
implementation.

Reorganise list by alphabetical order.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I79f1877d965084a77a1fdd573f8e227cd7f5ce74

2 years agoAdd generated arm-32 syscall instrumentation for kernel 6.0.7
Jérémie Galarneau [Fri, 11 Nov 2022 17:07:12 +0000 (12:07 -0500)] 
Add generated arm-32 syscall instrumentation for kernel 6.0.7

Generated by running:
  ./lttng-syscalls-generate-headers.sh pointers 6.0.7 arm-32-syscalls arm-32 32 && ./lttng-syscalls-generate-headers.sh integers 6.0.7 arm-32-syscalls arm-32 32

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2d76629b150627670fed23d94e80ae808c09d24b

2 years agoAdd generated x86-32 syscall instrumentation for kernel 6.0.7
Jérémie Galarneau [Tue, 8 Nov 2022 22:49:51 +0000 (17:49 -0500)] 
Add generated x86-32 syscall instrumentation for kernel 6.0.7

Generated by running:
  ./lttng-syscalls-generate-headers.sh pointers 6.0.7 x86-32-syscalls x86-32 32 && ./lttng-syscalls-generate-headers.sh integers 6.0.7 x86-32-syscalls x86-32 32

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia6513b25b4556a774317f89210c6f8ad8cbc8723

2 years agoFix: define old_sigaction as compat_old_sigaction in x86-32 compat
Jérémie Galarneau [Wed, 9 Nov 2022 22:20:06 +0000 (17:20 -0500)] 
Fix: define old_sigaction as compat_old_sigaction in x86-32 compat

In a follow-up patch which updates the instrumentation for x86-32, the
instrumentation of the old_sigaction() syscall would fail to build when
targeting a 64-bit kernel.

In that context, old_sigaction becomes compat_old_sigaction which is a
syscall that can be disabled (it was superseded by rt_sigaction a long
time ago).

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I633c80e03947a81d1b5c93f8f95a61feb7c34884

2 years agoAdd generated arm-64 syscall instrumentation for kernel 6.0.7
Jérémie Galarneau [Wed, 9 Nov 2022 19:34:30 +0000 (14:34 -0500)] 
Add generated arm-64 syscall instrumentation for kernel 6.0.7

Generated by running:
  ./lttng-syscalls-generate-headers.sh pointers 6.0.7 arm-64-syscalls arm-64 64 && ./lttng-syscalls-generate-headers.sh integers 6.0.7 arm-64-syscalls arm-64 64

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8cc65d1a16d66158a580cb492a82549f7f8c6ef1

2 years agoAdd generated x86-64 syscall instrumentation for kernel 6.0.7
Jérémie Galarneau [Tue, 8 Nov 2022 22:50:01 +0000 (17:50 -0500)] 
Add generated x86-64 syscall instrumentation for kernel 6.0.7

Generated by running:
  ./lttng-syscalls-generate-headers.sh pointers 6.0.7 x86-64-syscalls x86-64 64 && ./lttng-syscalls-generate-headers.sh integers 6.0.7 x86-64-syscalls x86-64 64

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8e21e72edac65627116cea356e827c5536d9503b

2 years agosyscall instrumentation: add missing forward declarations for old kernels
Mathieu Desnoyers [Thu, 17 Nov 2022 18:56:17 +0000 (13:56 -0500)] 
syscall instrumentation: add missing forward declarations for old kernels

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I70a511e83aa91ddff1976c7d6010f90eec7a9867

2 years agoAdd arm-32 syscall list for kernel 6.0.7
Jérémie Galarneau [Fri, 11 Nov 2022 17:05:26 +0000 (12:05 -0500)] 
Add arm-32 syscall list for kernel 6.0.7

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I939190435cdca26cdf14732b4036b3905b8d1d21

2 years agoAdd arm-64 syscall list for kernel 6.0.7
Jérémie Galarneau [Wed, 9 Nov 2022 18:52:04 +0000 (13:52 -0500)] 
Add arm-64 syscall list for kernel 6.0.7

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9262c2379b917b8c908b1c23850f87242fe891b2

2 years agoAdd x86-64 syscall list for kernel 6.0.7
Jérémie Galarneau [Tue, 8 Nov 2022 22:36:02 +0000 (17:36 -0500)] 
Add x86-64 syscall list for kernel 6.0.7

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I32c0d70b1a9e77598d9083a0f460ce37faa251de

2 years agoSupport per-architecture syscall in/out parameter descriptions
Jérémie Galarneau [Wed, 9 Nov 2022 20:44:09 +0000 (15:44 -0500)] 
Support per-architecture syscall in/out parameter descriptions

The number of arguments of some syscalls varies from one architecture to
another. For instance, fanotify_mark, on most architectures has the
following signature:

fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask, int dfd, const char *pathname)

However, on x86-32, the 64-bit mask parameter is split into two 32-bit parts:
fanotify_mark(int fanotify_fd, unsigned int flags, u32 mask_lo, u32 mask_hi, int dfd, const char *pathname)

Since the header generation scripts do not expect this, generating the
headers for x86-32 fails with:
  Error: argument number (6) is larger than number of syscall arguments (5)

The scripts are modified to search for an in/out description in a
per-architecture description list. For the moment only fanotify_mark()
has such an override.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7252f41f1d08100d099deab7328f7fc784e1c484

2 years agoAdd "_time32" suffixed variants of syscalls to table-syscall-inout.txt
Jérémie Galarneau [Wed, 9 Nov 2022 18:59:50 +0000 (13:59 -0500)] 
Add "_time32" suffixed variants of syscalls to table-syscall-inout.txt

In addressing a number of y2k38 upstream bugs, some syscalls had a
64-bit time variant added. In doing so, the superseded syscalls were
renamed *_time32.

table-syscall-inout.txt is adapted to consider both variants of these
syscalls.

This change is lifted from
https://review.lttng.org/c/lttng-modules/+/3208, originally produced by
Michael Jeanson.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I34511fb80fea1d17fd5eea7fccaffe1b5335a822

2 years agoAdd x86-32 syscall list for kernel 6.0.7
Jérémie Galarneau [Tue, 8 Nov 2022 22:12:07 +0000 (17:12 -0500)] 
Add x86-32 syscall list for kernel 6.0.7

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I34765714fb09c321470fa61d754c62e7074d44d8

2 years agoFix: syscalls-extractor: kallsyms_lookup_name no longer available
Jérémie Galarneau [Tue, 8 Nov 2022 22:13:37 +0000 (17:13 -0500)] 
Fix: syscalls-extractor: kallsyms_lookup_name no longer available

Since v5.7, kallsyms_lookup_name is no longer available.

In order to re-use the kallsyms wrapper, it is simpler to move the
syscalls extractor module to the `src` directory and gate its
compilation behind a new config option, CONFIG_LTTNG_SYSCALLS_EXTRACTOR.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I55d878dce55827d61035693aaf5865af3c4e775f

2 years agofix: Adjust ranges for RHEL 8.6 kernels
Michael Jeanson [Fri, 11 Nov 2022 15:47:54 +0000 (10:47 -0500)] 
fix: Adjust ranges for RHEL 8.6 kernels

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0b2c90f3678d0fb4503f61f336a4af185de2b39d

2 years agofix: kvm-x86 requires CONFIG_KALLSYMS_ALL
Michael Jeanson [Tue, 8 Nov 2022 16:26:46 +0000 (11:26 -0500)] 
fix: kvm-x86 requires CONFIG_KALLSYMS_ALL

Fixes: #1363
Change-Id: I6da15f77123c393ccb9109b562c7c8dc5bbb96a5
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoCleanup: remove 2.6.35 compat code
Michael Jeanson [Fri, 21 Oct 2022 16:12:23 +0000 (12:12 -0400)] 
Cleanup: remove 2.6.35 compat code

Change-Id: If429446d63fe6c33cd995b0e0e04bd26c5111cc7
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: mm/slab_common: drop kmem_alloc & avoid dereferencing fields when not using...
Michael Jeanson [Mon, 17 Oct 2022 17:49:51 +0000 (13:49 -0400)] 
fix: mm/slab_common: drop kmem_alloc & avoid dereferencing fields when not using (v6.1)

See uptream commit:

  commit 2c1d697fb8ba6d2d44f914d4268ae1ccdf025f1b
  Author: Hyeonggon Yoo <42.hyeyoo@gmail.com>
  Date:   Wed Aug 17 19:18:24 2022 +0900

    mm/slab_common: drop kmem_alloc & avoid dereferencing fields when not using

    Drop kmem_alloc event class, and define kmalloc and kmem_cache_alloc
    using TRACE_EVENT() macro.

    And then this patch does:
       - Do not pass pointer to struct kmem_cache to trace_kmalloc.
         gfp flag is enough to know if it's accounted or not.
       - Avoid dereferencing s->object_size and s->size when not using kmem_cache_alloc event.
       - Avoid dereferencing s->name in when not using kmem_cache_free event.
       - Adjust s->size to SLOB_UNITS(s->size) * SLOB_UNIT in SLOB

Change-Id: Icd7925731ed4a737699c3746cb7bb7760a4e8009
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoFix: handle integer capture page faults as skip field
Mathieu Desnoyers [Fri, 30 Sep 2022 20:19:16 +0000 (16:19 -0400)] 
Fix: handle integer capture page faults as skip field

Now that we have the appropriate save/restore position mechanism for
error handling in place, we can handle page faults on integer
copy-from-user by skipping the offending captured field entirely rather
than relying on an arbitrary 0 value.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4ec6243d96753ce7e9c6230563713aeacb126567

2 years agoFix: bytecode validator: reject specialized load field/context ref instructions
Mathieu Desnoyers [Fri, 30 Sep 2022 14:14:18 +0000 (10:14 -0400)] 
Fix: bytecode validator: reject specialized load field/context ref instructions

Reject specialized load field/context ref instructions so a bytecode
crafted with nefarious intent cannot:

- Read user-space memory without proper get_user accessors,
- Read a memory area larger than the memory targeted by the instrumentation.

This prevents bytecode received from a tracing group user from oopsing
the kernel or disclosing the content of kernel memory to the tracing
group

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2bda938a3a050f20be1d3d542aefe638b1b8bf73

2 years agoFix: bytecode validator: reject specialized load instructions
Mathieu Desnoyers [Thu, 29 Sep 2022 19:29:21 +0000 (15:29 -0400)] 
Fix: bytecode validator: reject specialized load instructions

Reject specialized load instructions so a bytecode crafted with
nefarious intent cannot:

- Read user-space memory without proper get_user accessors,
- Read a memory area larger than the memory targeted by the instrumentation.

This prevents bytecode received from a tracing group user from oopsing
the kernel or disclosing the content of kernel memory to the tracing
group.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6bcdf37d4a8601164082b3c24358bf0e765a2c92

2 years agoFix: honor "user" attribute for array/sequence of user integers
Mathieu Desnoyers [Thu, 29 Sep 2022 18:26:27 +0000 (14:26 -0400)] 
Fix: honor "user" attribute for array/sequence of user integers

The macro _lttng_kernel_static_type_integer_from_type() should map to
_lttng_kernel_static_type_integer() to pass the "_user" attribute.
Otherwise, userspace fields such as pipe2's system call fildes field (a
ctf_user_array()) can trigger NULL pointer exceptions and read arbitrary
kernel memory if the pipe2 system call receives a bogus pointer as input
while filtering/capture is accessing this field.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I44276d751b822f214804184d1ce4d9b10b47d89d

2 years agoFix: dma-fence.h appears in Linux 4.10, not 4.9
Mathieu Desnoyers [Wed, 28 Sep 2022 19:06:58 +0000 (15:06 -0400)] 
Fix: dma-fence.h appears in Linux 4.10, not 4.9

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id715db2f7d006b313250e6cbf3c52e417cdd7a7e

2 years agowrapper: powerpc64: fix kernel crash caused by do_get_kallsyms
He Zhe [Tue, 27 Sep 2022 07:59:42 +0000 (15:59 +0800)] 
wrapper: powerpc64: fix kernel crash caused by do_get_kallsyms

Kernel crashes on powerpc64 ABIv2 as follow when lttng_tracer initializes,
since do_get_kallsyms in lttng_wrapper fails to return a proper address of
kallsyms_lookup_name.

root@qemuppc64:~# lttng create trace_session --live -U net://127.0.0.1
Spawning a session daemon
lttng_kretprobes: loading out-of-tree module taints kernel.
BUG: Unable to handle kernel data access on read at 0xfffffffffffffff8
Faulting instruction address: 0xc0000000001f6fd0
Oops: Kernel access of bad area, sig: 11 [#1]
<snip>
NIP [c0000000001f6fd0] module_kallsyms_lookup_name+0xf0/0x180
LR [c0000000001f6f28] module_kallsyms_lookup_name+0x48/0x180
Call Trace:
module_kallsyms_lookup_name+0x34/0x180 (unreliable)
kallsyms_lookup_name+0x258/0x2b0
wrapper_kallsyms_lookup_name+0x4c/0xd0 [lttng_wrapper]
wrapper_get_pfnblock_flags_mask_init+0x28/0x60 [lttng_wrapper]
lttng_events_init+0x40/0x344 [lttng_tracer]
do_one_initcall+0x78/0x340
do_init_module+0x6c/0x2f0
__do_sys_finit_module+0xd0/0x120
system_call_exception+0x194/0x2f0
system_call_vectored_common+0xe8/0x278
<snip>

do_get_kallsyms makes use of kprobe_register and in turn kprobe_lookup_name
to get the address of the kernel function kallsyms_lookup_name. In case of
PPC64_ELF_ABI_v2, when kprobes are placed at function entry,
kprobe_lookup_name adjusts the global entry point of the function returned
by kallsyms_lookup_name to the local entry point(at some fixed offset of
global one). This adjustment is all for kprobes to be able to work properly.
Global and local entry point are defined in powerpc64 ABIv2.

When the local entry point is given, some instructions at the beginning of
the function are skipped and thus causes the above kernel crash. We just
want to make a simple function call which needs global entry point.

This patch adds 4 bytes which is the length of one instruction to
kallsyms_lookup_name so that it will not trigger the global to local
adjustment, and then substracts 4 bytes from the returned address. See the
following kernel change for more details.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=290e3070762ac80e5fc4087d8c4de7e3f1d90aca

Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I34e68e886b97e3976d0b5e25be295a8bb866c1a4

2 years agoFix: event notification: Remove duplicate event enabled check
Mathieu Desnoyers [Wed, 28 Sep 2022 14:44:05 +0000 (10:44 -0400)] 
Fix: event notification: Remove duplicate event enabled check

The event enabled checks are already done by the event notification
callers, so there is no point in checking it again.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8033c053d6a601cf646a008d5325d556dba5a8f9

2 years agoFix: event notification capture: validate buffer length
Mathieu Desnoyers [Wed, 28 Sep 2022 14:34:42 +0000 (10:34 -0400)] 
Fix: event notification capture: validate buffer length

Validate that the buffer length is large enough to hold empty capture
fields.

If the buffer is initially not large enough to hold empty capture fields
for each field to capture, discard the notification.

If after capturing a field there is not enough room anymore in the
buffer to write empty capture fields, skip the offending large field by
writing an empty capture field in its place.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifa2cdaf084e2ebee2efa052331107cb4d9095243

2 years agoFix: handle capture page faults as skip field
Mathieu Desnoyers [Tue, 27 Sep 2022 20:31:29 +0000 (16:31 -0400)] 
Fix: handle capture page faults as skip field

Now that we have the appropriate save/restore position mechanism for
error handling in place, we can handle page faults on copy-from-user by
skipping the offending captured field entirely rather than relying on an
empty string.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ibe1e818f57f8218d2b83281a572895884fc28b86

2 years agoFix: event notification capture error handling
Mathieu Desnoyers [Tue, 27 Sep 2022 19:07:24 +0000 (15:07 -0400)] 
Fix: event notification capture error handling

When the captured fields end up taking more than 512 bytes of space for
the msgpack message, the notification append capture fails.

Currently, this is handled by printing a WARN_ON_ONCE() on the console,
and a printk "Error appending capture to notification" warning.

Considering that this kind of error is very much legitimate, spamming
the console with warnings is not the way we want to handle this.

Rather than print a warning on the console, reset the msgpack writer
position to skip the problematic captured field entirely when it is
erroneous.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4c98dc85266dd7af5e11bbd3d73ab5118c9e03af

2 years agoFix: dma_fence tracepoint Kbuild typo
Mathieu Desnoyers [Tue, 27 Sep 2022 20:06:39 +0000 (16:06 -0400)] 
Fix: dma_fence tracepoint Kbuild typo

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9f603c3d4f10dd812ff33203928f9edac9b99489

2 years agoAdd new tracepoints for dma_fence
Rouven Czerwinski via lttng-dev [Thu, 8 Sep 2022 08:23:51 +0000 (10:23 +0200)] 
Add new tracepoints for dma_fence

Allows usage of dma_fence tracepoints from lttng.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoFix: capture_sequence_element_{un,}signed: handle user-space input
Mathieu Desnoyers [Mon, 5 Sep 2022 22:19:16 +0000 (18:19 -0400)] 
Fix: capture_sequence_element_{un,}signed: handle user-space input

The "user" attribute (copy from userspace) is not applied to
sequence/array of integer field capture within event notifications. This
could eventually lead to unsafe copy of integers from user-space.

Currently, the only array/sequence of integers which are read from
user-space are the arguments to sys_select (e.g. `readfds` field). Those
are expressed as "custom" fields, which are skipped by the filter and
capture bytecode.

This is therefore not an issue with the current instrumentation, but we
should properly handle this nevertheless.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icf0c141d333f63402d8a76051bcd53fcdd5ed8c2

2 years agoFix: notification capture: handle userspace strings
Mathieu Desnoyers [Tue, 6 Sep 2022 15:59:17 +0000 (11:59 -0400)] 
Fix: notification capture: handle userspace strings

The "user" attribute (copy from userspace) is not applied to string
field capture within event notifications. This leads to copy of strings
from user-space (e.g. `filename` field from sys_open) to end up using
strlen/memcpy on user-space data. This can cause kernel OOPS due to
unhandled page faults, and it also allows reading kernel memory through
the event notification capture mechanism. As a result, the users within
the `tracing` group can read arbitrary kernel memory.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3241b144fea849004a3f0a19276506c9f1b0d5e5

2 years agoImplement lttng_msgpack_write_user_str
Mathieu Desnoyers [Tue, 6 Sep 2022 15:57:58 +0000 (11:57 -0400)] 
Implement lttng_msgpack_write_user_str

Implement lttng_msgpack_write_user_str to allow safely capturing
user-space strings.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0354382cdd599b041fd20e59bb673fda7d72b2be

2 years agoFix: bytecode interpreter: LOAD_FIELD: handle user fields
Mathieu Desnoyers [Tue, 6 Sep 2022 19:10:17 +0000 (15:10 -0400)] 
Fix: bytecode interpreter: LOAD_FIELD: handle user fields

The instructions for recursive traversal through composed types
are used by the capture bytecode, and by filter expressions which
access fields nested within composed types.

Instructions BYTECODE_OP_LOAD_FIELD_STRING and
BYTECODE_OP_LOAD_FIELD_SEQUENCE were leaving the "user" attribute
uninitialized. Initialize those to 0.

The handling of userspace strings and integers is missing in LOAD_FIELD
instructions. Therefore, ensure that the specialization leaves the
generic LOAD_FIELD instruction in place for userspace input.

Add a "user" attribute to:
- struct bytecode_get_index_data elem field (produced by the
  specialization),
- struct vstack_load used by the specialization,
- struct load_ptr used by the interpreter.
- struct lttng_interpreter_output used by the event notification
  capture.

Use this "user" attribute in dynamic_load_field() for integer, string
and string_sequence object types to ensure that the proper
userspace-aware accesses are performed when loading those fields.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib8d4db5b7da5064e5897ab3802ab47e063607036

2 years agoFix: move "user" attribute from field to type
Mathieu Desnoyers [Mon, 5 Sep 2022 20:45:39 +0000 (16:45 -0400)] 
Fix: move "user" attribute from field to type

The "user" field attribute (copy from userspace) is not taken into
account in the bytecode specialization and interpreter recursive
traversal through composed types (LOAD_FIELD bytecode instructions).

Those are currently used by the event notification capture bytecode, and
by filter expressions which access fields nested within composed types.

Move the "user" attribute from the event fields to the integer and
string types. This will allow ensuring that the bytecode specialization,
interpreter and event notification output capture have access to this
user attribute even in nested types (e.g. arrays, sequences) in a
subsequent change.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I044a0845b256b5e2cf65aa0888af2b906678d19d

2 years agoIntroduce lttng_copy_from_user_check_nofault
Mathieu Desnoyers [Mon, 5 Sep 2022 21:55:37 +0000 (17:55 -0400)] 
Introduce lttng_copy_from_user_check_nofault

This code will be re-used by the event notification capture code, so
move it out of the ring buffer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I482adb5f619944285703425e278a70c601ce99b3

2 years agofix: adjust range v5.10.137 in block probe
Michael Jeanson [Mon, 22 Aug 2022 18:16:27 +0000 (14:16 -0400)] 
fix: adjust range v5.10.137 in block probe

See upstream commit, backported in v5.10.137 :

commit 1cb3032406423b25aa984854b4d78e0100d292dd
Author: Christoph Hellwig <hch@lst.de>
Date:   Thu Dec 3 17:21:39 2020 +0100

    block: remove the request_queue to argument request based tracepoints

    [ Upstream commit a54895fa057c67700270777f7661d8d3c7fda88a ]

    The request_queue can trivially be derived from the request.

Change-Id: I01f96a437641421faf993b4b031171c372bd0374
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: mm/tracing: add 'accounted' entry into output of allocation tracepoints (v6.0)
Michael Jeanson [Mon, 15 Aug 2022 21:22:47 +0000 (17:22 -0400)] 
fix: mm/tracing: add 'accounted' entry into output of allocation tracepoints (v6.0)

See upstream commit :

  commit b347aa7b57477f71c740e2bbc6d1078a7109ba23
  Author: Vasily Averin <vasily.averin@linux.dev>
  Date:   Fri Jun 3 06:21:49 2022 +0300

    mm/tracing: add 'accounted' entry into output of allocation tracepoints

    Slab caches marked with SLAB_ACCOUNT force accounting for every
    allocation from this cache even if __GFP_ACCOUNT flag is not passed.
    Unfortunately, at the moment this flag is not visible in ftrace output,
    and this makes it difficult to analyze the accounted allocations.

    This patch adds boolean "accounted" entry into trace output,
    and set it to 'true' for calls used __GFP_ACCOUNT flag and
    for allocations from caches marked with SLAB_ACCOUNT.
    Set it to 'false' if accounting is disabled in configs.

Change-Id: I023a355b94e79931499e1a1f648e2649d6dd3c89
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: block: remove bdevname (v6.0)
Michael Jeanson [Mon, 15 Aug 2022 18:39:42 +0000 (14:39 -0400)] 
fix: block: remove bdevname (v6.0)

See upstream commit :

  commit 900d156bac2bc474cf7c7bee4efbc6c83ec5ae58
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Wed Jul 13 07:53:17 2022 +0200

    block: remove bdevname

    Replace the remaining calls of bdevname with snprintf using the %pg
    format specifier.

Change-Id: I09f2afe91e549be2746334a4a09fc00be09b0778
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: fs/jbd2: Fix the documentation of the jbd2_write_superblock() callers (v6.0)
Michael Jeanson [Mon, 15 Aug 2022 21:21:20 +0000 (17:21 -0400)] 
fix: fs/jbd2: Fix the documentation of the jbd2_write_superblock() callers (v6.0)

See upstream commit :

  commit 6669797b0dd41ced457760b6e1014fdda8ce19ce
  Author: Bart Van Assche <bvanassche@acm.org>
  Date:   Thu Jul 14 11:07:22 2022 -0700

    Commit 2a222ca992c3 ("fs: have submit_bh users pass in op and flags
    separately") renamed the jbd2_write_superblock() 'write_op' argument into
    'write_flags'. Propagate this change to the jbd2_write_superblock()
    callers. Additionally, change the type of 'write_flags' into blk_opf_t.

Change-Id: I65b8af95b3d07438763dd94f409c197e3b400733
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: tie compaction probe build to CONFIG_COMPACTION
Michael Jeanson [Wed, 10 Aug 2022 15:07:14 +0000 (11:07 -0400)] 
fix: tie compaction probe build to CONFIG_COMPACTION

The definition of 'struct compact_control' in 'mm/internal.h' depends on
CONFIG_COMPACTION being defined. Only build the compaction probe when
this configuration option is enabled.

Thanks to Bruce Ashfield <bruce.ashfield@gmail.com> for reporting this
issue.

Change-Id: I81e77aa9c1bf10452c152d432fe5224df0db42c9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: net: skb: introduce kfree_skb_reason() (v5.15.58..v5.16)
Mathieu Desnoyers [Fri, 29 Jul 2022 19:37:43 +0000 (15:37 -0400)] 
fix: net: skb: introduce kfree_skb_reason() (v5.15.58..v5.16)

See upstream commit :

  commit c504e5c2f9648a1e5c2be01e8c3f59d394192bd3
  Author: Menglong Dong <imagedong@tencent.com>
  Date:   Sun Jan 9 14:36:26 2022 +0800

    net: skb: introduce kfree_skb_reason()

    Introduce the interface kfree_skb_reason(), which is able to pass
    the reason why the skb is dropped to 'kfree_skb' tracepoint.

    Add the 'reason' field to 'trace_kfree_skb', therefor user can get
    more detail information about abnormal skb with 'drop_monitor' or
    eBPF.

    All drop reasons are defined in the enum 'skb_drop_reason', and
    they will be print as string in 'kfree_skb' tracepoint in format
    of 'reason: XXX'.

    ( Maybe the reasons should be defined in a uapi header file, so that
    user space can use them? )

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib3c039207739dad10f097cf76474e0822e351273

2 years agofix: workqueue: Fix type of cpu in trace event (v5.19)
Michael Jeanson [Wed, 15 Jun 2022 16:07:16 +0000 (12:07 -0400)] 
fix: workqueue: Fix type of cpu in trace event (v5.19)

See upstream commit :

  commit 873a400938b31a1e443c4d94b560b78300787540
  Author: Wonhyuk Yang <vvghjk1234@gmail.com>
  Date:   Wed May 4 11:32:03 2022 +0900

    workqueue: Fix type of cpu in trace event

    The trace event "workqueue_queue_work" use unsigned int type for
    req_cpu, cpu. This casue confusing cpu number like below log.

    $ cat /sys/kernel/debug/tracing/trace
    cat-317  [001] ...: workqueue_queue_work: ... req_cpu=8192 cpu=4294967295

    So, change unsigned type to signed type in the trace event. After
    applying this patch, cpu number will be printed as -1 instead of
    4294967295 as folllows.

    $ cat /sys/kernel/debug/tracing/trace
    cat-1338  [002] ...: workqueue_queue_work: ... req_cpu=8192 cpu=-1

Change-Id: I478083c350b6ec314d87e9159dc5b342b96daed7
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.04569 seconds and 4 git commands to generate.