The member extent_map::block_start can be calculated from
extent_map::disk_bytenr + extent_map::offset for regular extents.
And otherwise just extent_map::disk_bytenr.
And this is already validated by the validate_extent_map(). Now we can
remove the member.
However there is a special case in btrfs_create_dio_extent() where we
for NOCOW/PREALLOC ordered extents cannot directly use the resulting
btrfs_file_extent, as btrfs_split_ordered_extent() cannot handle them
yet.
So for that call site, we pass file_extent->disk_bytenr +
file_extent->num_bytes as disk_bytenr for the ordered extent, and 0 for
offset.
Change-Id: I2e3245bb0d1f5263e902659aa05848d5e231909b Signed-off-by: Kienan Stewart <kstewart@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
The extent_map::block_len is either extent_map::len (non-compressed
extent) or extent_map::disk_num_bytes (compressed extent).
Since we already have sanity checks to do the cross-checks between the
new and old members, we can drop the old extent_map::block_len now.
For most call sites, they can manually select extent_map::len or
extent_map::disk_num_bytes, since most if not all of them have checked
if the extent is compressed.
Change-Id: Ib03fc685b4e876bf4e53afdd28ca9826342a0e4e Signed-off-by: Kienan Stewart <kstewart@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Since we have extent_map::offset, the old extent_map::orig_start is just
extent_map::start - extent_map::offset for non-hole/inline extents.
And since the new extent_map::offset is already verified by
validate_extent_map() while the old orig_start is not, let's just remove
the old member from all call sites.
Change-Id: I025a30d49b3e3ddc37d7846acc191ebbdf2ff19e Signed-off-by: Kienan Stewart <kstewart@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ext4: make ext4_da_reserve_space() reserve multi-clusters
Add 'nr_resv' parameter to ext4_da_reserve_space(), which indicates the
number of clusters wants to reserve, make it reserve multiple clusters
at a time.
Change-Id: Ib1ce8c3023d53a6d22ec444a435fdb3c871f64c5 Signed-off-by: Kienan Stewart <kstewart@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
skb does not include enough information to find out receiving
sockets/services and netns/containers on packet drops. In theory
skb->dev tells about netns, but it can get cleared/reused, e.g. by TCP
stack for OOO packet lookup. Similarly, skb->sk often identifies a local
sender, and tells nothing about a receiver.
Allow passing an extra receiving socket to the tracepoint to improve
the visibility on receiving drops.
Change-Id: I33c8ce1a48006456f198ab1592f733b55be01016 Signed-off-by: Kienan Stewart <kstewart@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Introduce two extension points for trace hit counters:
1) Future "actions" to perform other than "increment",
2) Future dimension indexing schemes (keys) other than tokens.
Change the layout of struct lttng_kernel_abi_counter_key_dimension
by adding a "key_type" field. A new struct lttng_kernel_abi_counter_key_dimension_tokens
inherits from struct lttng_kernel_abi_counter_key_dimension, and contains
the uint32_t nr_key_tokens field. The only currently supported key_type
is LTTNG_KERNEL_ABI_KEY_TYPE_TOKENS = 0.
Change the layout of struct lttng_kernel_abi_counter_event by adding an
"action" field. The only currently supported action is
LTTNG_KERNEL_ABI_COUNTER_ACTION_INCREMENT = 0.
Change the struct lttng_kernel_abi_key_token_string so it inherits from
struct lttng_kernel_abi_key_token. The "len" field of
struct lttng_kernel_abi_key_token now includes the length of the entire
child structure.
Remove struct lttng_kernel_abi_counter_key: it was previously expecting
all key dimensions to have the same size. But because each dimension can
be of a different type, each may have its own distinct size.
Change the newly introduced API between probe providers to change the
"event_counter_add" callback into a "counter_hit" callback, which takes
one less argument (no integer value), but takes additional stack_data,
probe_ctx, and event_counter_ctx arguments for future use.
Fix: event notifier: set eval_capture to false for kprobe, kretprobe and uprobe
Trying to capture fields for kprobe, kretprobe, uprobe, event
notifications will end up dereferencing NULL pointers. Prevent execution
of capture code in those cases.
Michael Jeanson [Tue, 18 Jun 2024 18:35:38 +0000 (14:35 -0400)]
Implement REUSE 3.0 with SPDX identifiers
Implement the full REUSE spec [1] to help with copyright and licensing
audits and compliance. This will reduce a lot of manual work for the
licensing audit required in Debian on each update and also allow using
automated tools.
For files that lacked copyright and licensing information, I used the
following guidelines. If a clear author could be determined from the git
history use it, otherwise use 'EfficiOS Inc.'. For code use
'GPL-2.0-only OR LGPL-2.1-only' unless otherwise stated, for
documentation 'CC-BY-SA-4.0' and for data files 'CC0-1.0'.
Freeform text files were converted to Markdown to allow licensing
comments.
Running the reuse tool on the repo is now succesful:
$ reuse lint
# SUMMARY
* Bad licenses: 0
* Deprecated licenses: 0
* Licenses without file extension: 0
* Missing licenses: 0
* Unused licenses: 0
* Used licenses: CC0-1.0, GPL-2.0-only, CC-BY-SA-4.0, MIT, LGPL-2.1-only
* Read errors: 0
* files with copyright information: 358 / 358
* files with license information: 358 / 358
Congratulations! Your project is compliant with version 3.0 of the REUSE Specification :-)
[1] https://reuse.software/tutorial/
Change-Id: I1755cab24a6fcec7a6c9a2136891418203ec34b8 Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 17 Jul 2024 15:32:31 +0000 (11:32 -0400)]
fix: add 'static inline' to lttng_kretprobes_init_event()
Add missing 'static inline' to lttng_kretprobes_init_event() placeholder
function when CONFIG_KRETPROBES is not set. Also some minor reformating
to improve readability.
Change-Id: I23cf83dff99f4168ae0f339c2b4911796e0b0273 Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 16 Jul 2024 21:02:36 +0000 (17:02 -0400)]
fix: copy_struct_from_user() for non-LTS branches < v4.19
The 'linux/bits.h' was backported to LTS branches but is not available
on non-LTS before v4.19. Use 'asm/byteorder.h' instead to get the
__LITTLE_ENDIAN define which is available on all kernel versions we
support.
Change-Id: Icfe733ab944616b3bd6d0023ad0869eefb830b34 Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Both lttng_abi_copy_user_old_counter_conf and
lttng_abi_copy_user_counter_conf should zero-init the counter_conf
destination argument, else the "dimension->flags" field is uninitialized
before being OR'd with flags.
Fix the following warning by splitting lttng_counter_ioctl (which has a
lot of local variables in the switch/case legs) into many sub-functions.
/home/efficios/git/lttng-modules/src/lttng-abi.c: In function ‘lttng_counter_ioctl’:
/home/efficios/git/lttng-modules/src/lttng-abi.c:1227:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]
1227 | }
| ^
Errors returned by lttng_kernel_event_create are handled by the caller,
and may happen e.g. when a kprobe or kretprobe symbol does not exist.
It should not generate a warning in the kernel console.
Fix: circular dependency on symbol lttng_id_tracker_lookup
Adding lttng_id_tracker_lookup feature into kprobes, uprobes and
kretprobes introduces a circular dependency between lttng-tracer.ko and
the respective probe modules.
There is no real reason for having the kprobes/uprobes/kretprobes
modules separate from the tracer core, so combine those.
Commit 0badc02f82b38 ("Fix: adjust SLE version ranges to build with SP2
and SP3") introduced code duplication. Modify the version match logic to
remove duplicated code.
Also remove the confusing comment about checking if a fd exists. I
could not find one instance in the entire kernel that still matches
the description or the reason for the name fcheck.
The need for better names became apparent in the last round of
discussion of this set of changes[1].
Michael Jeanson [Wed, 29 May 2024 19:02:15 +0000 (15:02 -0400)]
Warn and return on fd overflow fdt
The fdt should only grow and iterate_fd() holds file_lock, which should
ensure the fdt does not change while the lock is taken but be cautious
and check anyway.
Change-Id: Icd6a3263026734cbe3f296f6087f79add4148a8f Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
net: udp: add IP/port data to the tracepoint udp/udp_fail_queue_rcv_skb
The udp_fail_queue_rcv_skb() tracepoint lacks any details on the source
and destination IP/port whereas this information can be critical in case
of UDP/syslog.
Change-Id: I0c337c5817b0a120298cbf5088d60671d9625b0d Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
btrfs: move ->parent and ->ref_root into btrfs_delayed_ref_node
These two members are shared by both the tree refs and data refs, so
move them into btrfs_delayed_ref_node proper. This allows us to greatly
simplify the comparison code, as the shared refs always only sort on
parent, and the non shared refs always sort first on ref_root, and then
only data refs sort on their specific fields.
Change-Id: Ib7c92cc4bb8d674ac66ccfa25c03476f7adaaf90 Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Now that all of the delayed ref information is in the delayed ref node,
drastically simplify the delayed ref tracepoints by simply passing in
the btrfs_delayed_ref_node and populating the tracepoints with the
values from the structure itself.
Change-Id: Ic90bc23d6aa558baec33adc33b4d21e052e83375 Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 8 May 2024 18:20:30 +0000 (14:20 -0400)]
fix: Add missing 'pselect6_time32' and 'ppoll_time32' syscall overrides
The instrumentation currently has overrides to the generated syscall
tracepoints of 'ppoll' and 'pselect6' to extract additional information
from the parameters.
On arm-32 and x86-32 these 2 syscalls were renamed to 'ppoll_time32' and
'pselect6_time32' and new syscalls using 64-bit time_t were introduced
with the old names. This results in missing overrides on these
architectures for the 32-bit variants that were renamed.
Add the '_time32' overrides to restore the previous behavior.
Change-Id: I81e3a3ddc3f3cea58d86edcdf4a1fc9b600637c2 Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
The canary __canary__get_pfnblock_flags_mask has never done its job of
detecting changes to the prototype of get_pfnblock_flags_mask because
it was actually calling the wrapper, because the wrapper/page_alloc.h
header maps get_pfnblock_flags_mask to wrapper_get_pfnblock_flags_mask.
Unfortunately, this wrapper is included by page_alloc.c only _after_ the
linux/pageblock-flags.h header is included, which means the
get_pfnblock_flags_mask prototype does _not_ have the wrapper prefix,
which prevents it from being useful for any kind of type validation.
This has been detected by a compiler warning stating that
wrapper_get_pfnblock_flags_mask() does not have a prior declaration.
Move the wrapper/page_alloc.h include _before_ including
pageblock-flags.h. This ensures the declaration has the wrapper_ prefix,
and therefore the compiler compares the declaration with the definition
of wrapper_get_pfnblock_flags_mask within page_alloc.c. The canary
function can be removed because it is redundant with this type check.
With this proper type check in place, we notice the following two
changes upstream:
commit 535b81e209219 ("mm/page_alloc.c: remove unnecessary end_bitidx for [set|get]_pfnblock_flags_mask()")
introduced in v5.9 removes the end_bitidx argument.
commit ca891f41c4c79 ("mm: constify get_pfnblock_flags_mask and get_pfnblock_migratetype")
introduced in v5.14 adds a const qualifier to the struct page pointer.
Adapt the code to match the evolution of this prototype.