From d2c394c735875111342402ec6cdfb8fc6bcc42d7 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:44:05 -0400 Subject: [PATCH 01/16] blkdev wrapper: Fix constness warning Upstream commit f8c7511db009d ("block: make block_class constant") makes the block_class const. Reflect this change in the lttng-modules canary function. Signed-off-by: Mathieu Desnoyers Change-Id: Ib3aadd3dedc413f8370b9739f200ce9663c38d99 --- include/wrapper/blkdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/wrapper/blkdev.h b/include/wrapper/blkdev.h index b637bb91..76397f6b 100644 --- a/include/wrapper/blkdev.h +++ b/include/wrapper/blkdev.h @@ -52,7 +52,7 @@ struct class *wrapper_get_block_class(void) * extern struct class block_class; */ static inline -struct class *__canary__get_block_class(void) +const struct class *__canary__get_block_class(void) { return &block_class; } -- 2.34.1 From c4d6de426e681f6760a883fe47f2b6c52075b021 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:45:24 -0400 Subject: [PATCH 02/16] ring buffer: Add missing static to function definitions Signed-off-by: Mathieu Desnoyers Change-Id: I80c03d8c8879777e37d24c3574ba7bdea512446a --- src/lib/ringbuffer/ring_buffer_frontend.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/ringbuffer/ring_buffer_frontend.c b/src/lib/ringbuffer/ring_buffer_frontend.c index 5e072883..df0705cb 100644 --- a/src/lib/ringbuffer/ring_buffer_frontend.c +++ b/src/lib/ringbuffer/ring_buffer_frontend.c @@ -2416,6 +2416,7 @@ void lib_ring_buffer_check_deliver_slow(const struct lttng_kernel_ring_buffer_co } EXPORT_SYMBOL_GPL(lib_ring_buffer_check_deliver_slow); +static int __init init_lib_ring_buffer_frontend(void) { int cpu; @@ -2427,6 +2428,7 @@ int __init init_lib_ring_buffer_frontend(void) module_init(init_lib_ring_buffer_frontend); +static void __exit exit_lib_ring_buffer_frontend(void) { } -- 2.34.1 From 56386a64c1bb8885d5fe6f95fe9167217b75de3e Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:45:45 -0400 Subject: [PATCH 03/16] lttng-abi: Add missing static to function definitions Signed-off-by: Mathieu Desnoyers Change-Id: Icc6928df5a47c96a560e18b2c854780afbcf6307 --- src/lttng-abi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lttng-abi.c b/src/lttng-abi.c index caec803f..afd23373 100644 --- a/src/lttng-abi.c +++ b/src/lttng-abi.c @@ -121,6 +121,7 @@ fd_error: return ret; } +static void event_notifier_send_notification_work_wakeup(struct irq_work *entry) { struct lttng_event_notifier_group *event_notifier_group = @@ -2576,6 +2577,7 @@ long lttng_metadata_ioctl(struct file *file, unsigned int cmd, unsigned long arg * @file: the file * @wait: poll table */ +static unsigned int lttng_channel_poll(struct file *file, poll_table *wait) { struct lttng_kernel_channel_buffer *channel = file->private_data; -- 2.34.1 From 539d4a7cf688ed179eb97a6de481fa10e77616ba Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:46:07 -0400 Subject: [PATCH 04/16] lttng-bytecode: Remove dead code Functions lttng_filter_enabler_attach_bytecode and lttng_free_enabler_filter_bytecode are unused since the refactoring of lttng 2.13. Remove them. Signed-off-by: Mathieu Desnoyers Change-Id: I2abbb3906cdb5c1b7fa9c27c7871a51af7697832 --- src/lttng-bytecode.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/lttng-bytecode.c b/src/lttng-bytecode.c index 7708293e..3d283268 100644 --- a/src/lttng-bytecode.c +++ b/src/lttng-bytecode.c @@ -596,26 +596,6 @@ void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_des } } -/* - * We own the filter_bytecode if we return success. - */ -int lttng_filter_enabler_attach_bytecode(struct lttng_event_enabler_common *enabler, - struct lttng_kernel_bytecode_node *filter_bytecode) -{ - list_add(&filter_bytecode->node, &enabler->filter_bytecode_head); - return 0; -} - -void lttng_free_enabler_filter_bytecode(struct lttng_event_enabler_common *enabler) -{ - struct lttng_kernel_bytecode_node *filter_bytecode, *tmp; - - list_for_each_entry_safe(filter_bytecode, tmp, - &enabler->filter_bytecode_head, node) { - kfree(filter_bytecode); - } -} - void lttng_free_event_filter_runtime(struct lttng_kernel_event_common *event) { struct bytecode_runtime *runtime, *tmp; -- 2.34.1 From 01f146dd5f9b420ff996016bd229ee5053f17656 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:46:52 -0400 Subject: [PATCH 05/16] lttng-calibrate: Add missing static and include Include lttng/events-internal.h for the lttng_calibrate declaration. Make lttng_calibrate_kretprobe static. Signed-off-by: Mathieu Desnoyers Change-Id: Ia18aa60e69cae7a16ed7d17c8297d7ad3bb3aca2 --- src/lttng-calibrate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lttng-calibrate.c b/src/lttng-calibrate.c index 56ee8cf8..a545ce8a 100644 --- a/src/lttng-calibrate.c +++ b/src/lttng-calibrate.c @@ -9,8 +9,9 @@ #include #include +#include -noinline +static noinline void lttng_calibrate_kretprobe(void) { asm volatile (""); -- 2.34.1 From 9139e0fa272d454181bdd59559e4e32e4ab24027 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:48:05 -0400 Subject: [PATCH 06/16] lttng-clock: Add missing lttng/events-internal.h include Needed for lttng_clock_ref and lttng_clock_unref declarations. Signed-off-by: Mathieu Desnoyers Change-Id: Idb21d942b9e2151f1d5a78b31b28ca1ac455719b --- src/lttng-clock.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lttng-clock.c b/src/lttng-clock.c index 2e623be3..2f5146db 100644 --- a/src/lttng-clock.c +++ b/src/lttng-clock.c @@ -12,6 +12,7 @@ #include #include #include +#include struct lttng_trace_clock *lttng_trace_clock; EXPORT_SYMBOL_GPL(lttng_trace_clock); -- 2.34.1 From c88dc738c9b82013d8e1b3f5aa3dfc4595dfb570 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:49:08 -0400 Subject: [PATCH 07/16] context callstack: Add missing static lttng_cs_event_fields() is only used within the compile unit, mark it static. Signed-off-by: Mathieu Desnoyers Change-Id: I3435c6de411a0671de86ecdbcb3e1ea019d908e6 --- src/lttng-context-callstack.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lttng-context-callstack.c b/src/lttng-context-callstack.c index 5034d8a7..4385472e 100644 --- a/src/lttng-context-callstack.c +++ b/src/lttng-context-callstack.c @@ -120,6 +120,7 @@ static const struct lttng_kernel_event_field *event_fields_user[NR_FIELDS] = { false, false), }; +static const struct lttng_kernel_event_field **lttng_cs_event_fields(enum lttng_cs_ctx_modes mode) { switch (mode) { -- 2.34.1 From 11a1e5f29119132d03b6316384e7a32b917be0dc Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:49:37 -0400 Subject: [PATCH 08/16] event notifier: Add missing static Mark capture_sequence() static because it is only used within the compile unit. Signed-off-by: Mathieu Desnoyers Change-Id: I003e5cf016fbf2f2df24f4550a6c285e020956d0 --- src/lttng-event-notifier-notification.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lttng-event-notifier-notification.c b/src/lttng-event-notifier-notification.c index ecbc0676..29d2d156 100644 --- a/src/lttng-event-notifier-notification.c +++ b/src/lttng-event-notifier-notification.c @@ -246,6 +246,7 @@ int capture_sequence_element_unsigned(uint8_t *ptr, return 0; } +static int capture_sequence(struct lttng_msgpack_writer *writer, struct lttng_interpreter_output *output) { -- 2.34.1 From 435454a76c63eb3f574562aeb8146fba8889b25e Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:50:19 -0400 Subject: [PATCH 09/16] lttng-events: Add missing static get_tracker() and lttng_metadata_printf() are only used within the compile unit, mark them as static. Signed-off-by: Mathieu Desnoyers Change-Id: Ie454c85cc29a30d964922fcfe1f88f3fb91bbc8f --- src/lttng-events.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lttng-events.c b/src/lttng-events.c index a0bd2322..b8fa11e3 100644 --- a/src/lttng-events.c +++ b/src/lttng-events.c @@ -1547,6 +1547,7 @@ void _lttng_event_destroy(struct lttng_kernel_event_common *event) } } +static struct lttng_kernel_id_tracker *get_tracker(struct lttng_kernel_session *session, enum tracker_type tracker_type) { @@ -2818,6 +2819,7 @@ void lttng_metadata_end(struct lttng_kernel_session *session) * The content of the printf is printed as a single atomic metadata * transaction. */ +static int lttng_metadata_printf(struct lttng_kernel_session *session, const char *fmt, ...) { -- 2.34.1 From cac5a777e47a880008434922ba931d7c700d6fc4 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:51:39 -0400 Subject: [PATCH 10/16] lttng-events: Remove dead code Functions lttng_event_notifier_enabler_enable and lttng_event_notifier_enabler_disable are unused since the 2.13 refactoring, remove them. Signed-off-by: Mathieu Desnoyers Change-Id: I18d0d483bf54cbc7d158413f27111271c68ac37d --- src/lttng-events.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/lttng-events.c b/src/lttng-events.c index b8fa11e3..73f591fd 100644 --- a/src/lttng-events.c +++ b/src/lttng-events.c @@ -2448,26 +2448,6 @@ void lttng_event_notifier_enabler_group_add(struct lttng_event_notifier_group *e mutex_unlock(&sessions_mutex); } -int lttng_event_notifier_enabler_enable( - struct lttng_event_notifier_enabler *event_notifier_enabler) -{ - mutex_lock(&sessions_mutex); - lttng_event_notifier_enabler_as_enabler(event_notifier_enabler)->enabled = 1; - lttng_event_notifier_group_sync_enablers(event_notifier_enabler->group); - mutex_unlock(&sessions_mutex); - return 0; -} - -int lttng_event_notifier_enabler_disable( - struct lttng_event_notifier_enabler *event_notifier_enabler) -{ - mutex_lock(&sessions_mutex); - lttng_event_notifier_enabler_as_enabler(event_notifier_enabler)->enabled = 0; - lttng_event_notifier_group_sync_enablers(event_notifier_enabler->group); - mutex_unlock(&sessions_mutex); - return 0; -} - int lttng_event_notifier_enabler_attach_capture_bytecode( struct lttng_event_notifier_enabler *event_notifier_enabler, struct lttng_kernel_abi_capture_bytecode __user *bytecode) -- 2.34.1 From 0f7e7309025e8c95b8e1b47ad3d3378b6b40895d Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:52:54 -0400 Subject: [PATCH 11/16] statedump: Add missing events-internal.h include Include events-internal.h for the declaration of lttng_statedump_start(). Signed-off-by: Mathieu Desnoyers Change-Id: Ieda391aa0d780113efe1d517d8bc5aedb2095a2c --- src/lttng-statedump-impl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lttng-statedump-impl.c b/src/lttng-statedump-impl.c index 4a228ce4..a0e97e1c 100644 --- a/src/lttng-statedump-impl.c +++ b/src/lttng-statedump-impl.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include -- 2.34.1 From f88cb8f515407b94d461a5ad356e3234556943a8 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:54:20 -0400 Subject: [PATCH 12/16] syscalls: Remove unused duplicated code lttng_abi_syscall_list() was moved to src/lttng-abi.c within the 2.13 refactoring. Remove this unused copy. Signed-off-by: Mathieu Desnoyers Change-Id: Iabbab3b576e3d85bc5ac9831729a5786b5c5f224 --- src/lttng-syscalls.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/src/lttng-syscalls.c b/src/lttng-syscalls.c index 5ec6be5a..827ca1d3 100644 --- a/src/lttng-syscalls.c +++ b/src/lttng-syscalls.c @@ -1310,35 +1310,3 @@ long lttng_syscall_table_get_active_mask(struct lttng_kernel_syscall_table *sysc kfree(tmp_mask); return ret; } - -int lttng_abi_syscall_list(void) -{ - struct file *syscall_list_file; - int file_fd, ret; - - file_fd = get_unused_fd_flags(0); - if (file_fd < 0) { - ret = file_fd; - goto fd_error; - } - - syscall_list_file = anon_inode_getfile("[lttng_syscall_list]", - <tng_syscall_list_fops, - NULL, O_RDWR); - if (IS_ERR(syscall_list_file)) { - ret = PTR_ERR(syscall_list_file); - goto file_error; - } - ret = lttng_syscall_list_fops.open(NULL, syscall_list_file); - if (ret < 0) - goto open_error; - fd_install(file_fd, syscall_list_file); - return file_fd; - -open_error: - fput(syscall_list_file); -file_error: - put_unused_fd(file_fd); -fd_error: - return ret; -} -- 2.34.1 From e0d345140e84acd4f2716f6f0cc4824ffaf9df4b Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:55:16 -0400 Subject: [PATCH 13/16] uprobes: Remove dead code lttng_uprobes_destroy_event_notifier_private is now unused. Remove it. Signed-off-by: Mathieu Desnoyers Change-Id: Ia995c60691f68090b6853b2deb0d265b1d4a047e --- src/probes/lttng-uprobes.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/probes/lttng-uprobes.c b/src/probes/lttng-uprobes.c index edded1e9..5463251a 100644 --- a/src/probes/lttng-uprobes.c +++ b/src/probes/lttng-uprobes.c @@ -305,14 +305,6 @@ void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_common *event } EXPORT_SYMBOL_GPL(lttng_uprobes_destroy_event_private); -void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier) -{ - iput(event_notifier->priv->parent.u.uprobe.inode); - kfree(event_notifier->priv->parent.desc->event_name); - kfree(event_notifier->priv->parent.desc); -} -EXPORT_SYMBOL_GPL(lttng_uprobes_destroy_event_notifier_private); - MODULE_LICENSE("GPL and additional rights"); MODULE_AUTHOR("Yannick Brosseau"); MODULE_DESCRIPTION("Linux Trace Toolkit Uprobes Support"); -- 2.34.1 From 75624557016686e35bdd521269abeec49365d170 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 13:55:44 -0400 Subject: [PATCH 14/16] lttng probe: include events-internal.h Include events-internal.h for the declarations of lttng_logger_init and lttng_logger_exit. Signed-off-by: Mathieu Desnoyers Change-Id: I14968060c309083f90a282f186f3c635f1ebfd8d --- src/probes/lttng.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/probes/lttng.c b/src/probes/lttng.c index 98558567..23b1de9e 100644 --- a/src/probes/lttng.c +++ b/src/probes/lttng.c @@ -18,6 +18,7 @@ #include #include #include +#include #define TP_MODULE_NOAUTOLOAD #define LTTNG_PACKAGE_BUILD -- 2.34.1 From d16e08f96b7dd6e1bd5fdeb5aca038896600d9f4 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 9 May 2024 14:43:05 -0400 Subject: [PATCH 15/16] page alloc wrapper: Fix get_pfnblock_flags_mask prototype 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. Signed-off-by: Mathieu Desnoyers Change-Id: I51b7871edfbff0f74ba1cf4d0ad988eb8d642b4e --- src/wrapper/page_alloc.c | 74 +++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 20 deletions(-) diff --git a/src/wrapper/page_alloc.c b/src/wrapper/page_alloc.c index 5e19d7b5..69988e66 100644 --- a/src/wrapper/page_alloc.c +++ b/src/wrapper/page_alloc.c @@ -11,12 +11,63 @@ #ifdef CONFIG_KALLSYMS +/* Include page_alloc wrapper before pageblock-flags.h. */ +#include + +#include #include #include #include #include -#include +#include + +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,14,0)) +static +unsigned long (*get_pfnblock_flags_mask_sym)(const struct page *page, + unsigned long pfn, + unsigned long mask); + +unsigned long wrapper_get_pfnblock_flags_mask(const struct page *page, + unsigned long pfn, + unsigned long mask) +{ + WARN_ON_ONCE(!get_pfnblock_flags_mask_sym); + if (get_pfnblock_flags_mask_sym) { + struct irq_ibt_state irq_ibt_state; + unsigned long ret; + irq_ibt_state = wrapper_irq_ibt_save(); + ret = get_pfnblock_flags_mask_sym(page, pfn, mask); + wrapper_irq_ibt_restore(irq_ibt_state); + return ret; + } else { + return -ENOSYS; + } +} +#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0)) +static +unsigned long (*get_pfnblock_flags_mask_sym)(struct page *page, + unsigned long pfn, + unsigned long mask); + +unsigned long wrapper_get_pfnblock_flags_mask(struct page *page, + unsigned long pfn, + unsigned long mask) +{ + WARN_ON_ONCE(!get_pfnblock_flags_mask_sym); + if (get_pfnblock_flags_mask_sym) { + struct irq_ibt_state irq_ibt_state; + unsigned long ret; + + irq_ibt_state = wrapper_irq_ibt_save(); + ret = get_pfnblock_flags_mask_sym(page, pfn, mask); + wrapper_irq_ibt_restore(irq_ibt_state); + return ret; + } else { + return -ENOSYS; + } +} +#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0)) */ static unsigned long (*get_pfnblock_flags_mask_sym)(struct page *page, unsigned long pfn, @@ -41,6 +92,8 @@ unsigned long wrapper_get_pfnblock_flags_mask(struct page *page, return -ENOSYS; } } +#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0)) */ + EXPORT_SYMBOL_GPL(wrapper_get_pfnblock_flags_mask); int wrapper_get_pfnblock_flags_mask_init(void) @@ -53,25 +106,6 @@ int wrapper_get_pfnblock_flags_mask_init(void) } EXPORT_SYMBOL_GPL(wrapper_get_pfnblock_flags_mask_init); -/* - * Canary function to check for 'get_pfnblock_flags_mask()' at compile time. - * - * From 'include/linux/pageblock-flags.h': - * - * unsigned long get_pfnblock_flags_mask(struct page *page, - * unsigned long pfn, - * unsigned long end_bitidx, - * unsigned long mask); - */ -__attribute__((unused)) static -unsigned long __canary__get_pfnblock_flags_mask(struct page *page, - unsigned long pfn, - unsigned long end_bitidx, - unsigned long mask) -{ - return get_pfnblock_flags_mask(page, pfn, end_bitidx, mask); -} - #else #include -- 2.34.1 From 92dd6990b635d31390e073507ec51c19128a562f Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Wed, 8 May 2024 14:20:30 -0400 Subject: [PATCH 16/16] 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 Signed-off-by: Mathieu Desnoyers --- .../syscalls/syscalls_pointers_override.h | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/include/instrumentation/syscalls/syscalls_pointers_override.h b/include/instrumentation/syscalls/syscalls_pointers_override.h index 00e5990c..92467749 100644 --- a/include/instrumentation/syscalls/syscalls_pointers_override.h +++ b/include/instrumentation/syscalls/syscalls_pointers_override.h @@ -390,6 +390,11 @@ end: ; /* Label at end of compound statement. */ \ lttng_tp_mempool_free(tp_locvar->fds_ex); #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) +/* + * Instead of extracting the user-space pointers of the 3 fd_set, + * extract the bitmask of the FDs in the sets (in, out, ex) in the form + * of an array of uint8_t (1024 FDs is the limit in the kernel). + */ #define OVERRIDE_32_select #define OVERRIDE_64_select SC_LTTNG_TRACEPOINT_EVENT_CODE(select, @@ -427,6 +432,11 @@ SC_LTTNG_TRACEPOINT_EVENT_CODE(select, #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) */ #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) +/* + * Instead of extracting the user-space pointers of the 3 fd_set, + * extract the bitmask of the FDs in the sets (in, out, ex) in the form + * of an array of uint8_t (1024 FDs is the limit in the kernel). + */ #define OVERRIDE_32_pselect6 #define OVERRIDE_64_pselect6 SC_LTTNG_TRACEPOINT_EVENT_CODE(pselect6, @@ -464,6 +474,48 @@ SC_LTTNG_TRACEPOINT_EVENT_CODE(pselect6, ) #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ +#if defined(CONFIG_X86_32) || defined(CONFIG_ARM) +/* + * Instead of extracting the user-space pointers of the 3 fd_set, + * extract the bitmask of the FDs in the sets (in, out, ex) in the form + * of an array of uint8_t (1024 FDs is the limit in the kernel). + */ +#define OVERRIDE_32_pselect6_time32 +SC_LTTNG_TRACEPOINT_EVENT_CODE(pselect6_time32, + TP_PROTO(sc_exit(long ret,) int n, fd_set __user * inp, fd_set __user * outp, + fd_set __user * exp, struct old_timespec32 __user * tvp, void __user * sig), + TP_ARGS(sc_exit(ret,) n, inp, outp, exp, tvp, sig), + TP_locvar( + LTTNG_SYSCALL_SELECT_locvar + ), + TP_code_pre( + LTTNG_SYSCALL_SELECT_code_pre + ), + TP_FIELDS( + sc_exit(ctf_integer(long, ret, ret)) + sc_in(ctf_integer(int, n, n)) + sc_inout(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) + sc_inout(ctf_integer(struct old_timespec32 *, tvp, tvp)) + sc_in(ctf_integer_hex(void *, sig, sig)) + + sc_inout( +#if (__BYTE_ORDER == __LITTLE_ENDIAN) + LTTNG_SYSCALL_SELECT_fds_field_LE(readfds, inp) + LTTNG_SYSCALL_SELECT_fds_field_LE(writefds, outp) + LTTNG_SYSCALL_SELECT_fds_field_LE(exceptfds, exp) +#else + LTTNG_SYSCALL_SELECT_fds_field_BE(readfds, inp) + LTTNG_SYSCALL_SELECT_fds_field_BE(writefds, outp) + LTTNG_SYSCALL_SELECT_fds_field_BE(exceptfds, exp) +#endif + ) + ), + TP_code_post( + LTTNG_SYSCALL_SELECT_code_post + ) +) +#endif /* defined(CONFIG_X86_32) || defined(CONFIG_ARM) */ + #ifdef LTTNG_CREATE_FIELD_METADATA #ifndef ONCE_LTTNG_TRACE_POLL_H #define ONCE_LTTNG_TRACE_POLL_H @@ -652,6 +704,13 @@ end: \ lttng_tp_mempool_free(tp_locvar->fds); #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) +/* + * Instead of printing the pointer address of the poll set, extract all the FDs + * and flags from the poll set. For now, only output the standardized + * set of events to limit the verbosity of the output, and also extract + * the raw value. In the future, moving to CTF2 will allow hiding unset + * fields and then allow extracting all the fields. + */ #define OVERRIDE_32_poll #define OVERRIDE_64_poll SC_LTTNG_TRACEPOINT_EVENT_CODE(poll, @@ -679,6 +738,13 @@ SC_LTTNG_TRACEPOINT_EVENT_CODE(poll, #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) */ #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) +/* + * Instead of printing the pointer address of the poll set, extract all the FDs + * and flags from the poll set. For now, only output the standardized + * set of events to limit the verbosity of the output, and also extract + * the raw value. In the future, moving to CTF2 will allow hiding unset + * fields and then allow extracting all the fields. + */ #define OVERRIDE_32_ppoll #define OVERRIDE_64_ppoll SC_LTTNG_TRACEPOINT_EVENT_CODE(ppoll, @@ -707,6 +773,41 @@ SC_LTTNG_TRACEPOINT_EVENT_CODE(ppoll, ) #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ +#if defined(CONFIG_X86_32) || defined(CONFIG_ARM) +/* + * Instead of printing the pointer address of the poll set, extract all the FDs + * and flags from the poll set. For now, only output the standardized + * set of events to limit the verbosity of the output, and also extract + * the raw value. In the future, moving to CTF2 will allow hiding unset + * fields and then allow extracting all the fields. + */ +#define OVERRIDE_32_ppoll_time32 +SC_LTTNG_TRACEPOINT_EVENT_CODE(ppoll_time32, + TP_PROTO(sc_exit(long ret,) struct pollfd __user * ufds, + unsigned int nfds, struct old_timespec32 * tsp, const sigset_t * sigmask, size_t sigsetsize), + TP_ARGS(sc_exit(ret,) ufds, nfds, tsp, sigmask, sigsetsize), + TP_locvar( + LTTNG_SYSCALL_POLL_locvar + ), + TP_code_pre( + LTTNG_SYSCALL_POLL_code_pre + ), + TP_FIELDS( + sc_exit(ctf_integer(long, ret, ret)) + sc_in(ctf_integer(struct old_timespec32 *, tsp, tsp)) + sc_in(ctf_integer(const sigset_t *, sigmask, sigmask)) + sc_in(ctf_integer(size_t, sigsetsize, sigsetsize)) + sc_inout(ctf_integer(unsigned int, nfds, nfds)) + sc_inout(ctf_integer(unsigned int, fds_length, tp_locvar->fds_length)) + sc_inout(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) + LTTNG_SYSCALL_POLL_fds_field + ), + TP_code_post( + LTTNG_SYSCALL_POLL_code_post + ) +) +#endif /* defined(CONFIG_X86_32) || defined(CONFIG_ARM) */ + #include SC_LTTNG_TRACEPOINT_ENUM(lttng_epoll_op, -- 2.34.1