From: Michael Jeanson Date: Mon, 21 Nov 2022 22:26:59 +0000 (-0500) Subject: Cleanup: update stale file paths in LICENSE X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=HEAD;hp=75624557016686e35bdd521269abeec49365d170;p=lttng-modules.git Cleanup: update stale file paths in LICENSE Change-Id: I4849b19daa235b93a6435e57bd764128e43d691e Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/LICENSE b/LICENSE index 04013e66..59a5edb2 100644 --- a/LICENSE +++ b/LICENSE @@ -13,10 +13,10 @@ details), except for files identified by the following sections. These files are licensed exclusively under the GPL-2.0 license. See LICENSES/GPL-2.0 for details. -lib/ringbuffer/ring_buffer_splice.c -lib/ringbuffer/ring_buffer_mmap.c -instrumentation/events/lttng-module/*.h -wrapper/list.h +src/lib/ringbuffer/ring_buffer_splice.c +src/lib/ringbuffer/ring_buffer_mmap.c +include/instrumentation/events/*.h +include/wrapper/list.h * MIT-style license @@ -25,10 +25,10 @@ for details. include/lttng/prio_heap.h include/lttng/bitfield.h -include/lttng/filter-bytecode.h -include/filter.h -lib/prio_heap/lttng_prio_heap.c -lttng-filter-interpreter.c -lttng-filter-specialize.c -lttng-filter-validator.c -lttng-filter.c +include/lttng/bytecode.h +include/lttng/lttng-bytecode.h +src/lib/prio_heap/lttng_prio_heap.c +src/lttng-bytecode-interpreter.c +src/lttng-bytecode-specialize.c +src/lttng-bytecode-validator.c +src/lttng-bytecode.c diff --git a/include/instrumentation/events/btrfs.h b/include/instrumentation/events/btrfs.h index 4d286ef4..88709cfe 100644 --- a/include/instrumentation/events/btrfs.h +++ b/include/instrumentation/events/btrfs.h @@ -958,7 +958,51 @@ LTTNG_TRACEPOINT_EVENT(btrfs_add_block_group, ) #endif -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0) || \ +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,10,0)) +LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_tree_ref, + + TP_PROTO(const struct btrfs_fs_info *fs_info, + const struct btrfs_delayed_ref_node *ref), + + TP_ARGS(fs_info, ref), + + TP_FIELDS( + ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE) + ctf_integer(u64, bytenr, ref->bytenr) + ctf_integer(u64, num_bytes, ref->num_bytes) + ctf_integer(int, action, ref->action) + ctf_integer(u64, parent, ref->parent) + ctf_integer(u64, ref_root, ref->ref_root) + ctf_integer(int, level, ref->tree_ref.level) + ctf_integer(int, type, ref->type) + ctf_integer(u64, seq, ref->seq) + ) +) + +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_tree_ref, + + add_delayed_tree_ref, + + btrfs_add_delayed_tree_ref, + + TP_PROTO(const struct btrfs_fs_info *fs_info, + const struct btrfs_delayed_ref_node *ref), + + TP_ARGS(fs_info, ref) +) + +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_tree_ref, + + run_delayed_tree_ref, + + btrfs_run_delayed_tree_ref, + + TP_PROTO(const struct btrfs_fs_info *fs_info, + const struct btrfs_delayed_ref_node *ref), + + TP_ARGS(fs_info, ref) +) +#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0) || \ LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \ LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \ LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \ @@ -1159,7 +1203,53 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_tree_ref, ) #endif -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0) || \ +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,10,0)) +LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_data_ref, + + TP_PROTO(const struct btrfs_fs_info *fs_info, + const struct btrfs_delayed_ref_node *ref), + + TP_ARGS(fs_info, ref), + + TP_FIELDS( + ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE) + ctf_integer(u64, bytenr, ref->bytenr) + ctf_integer(u64, num_bytes, ref->num_bytes) + ctf_integer(int, action, ref->action) + ctf_integer(u64, parent, ref->parent) + ctf_integer(u64, ref_root, ref->ref_root) + ctf_integer(u64, owner, ref->data_ref.objectid) + ctf_integer(u64, offset, ref->data_ref.offset) + ctf_integer(int, type, ref->type) + ctf_integer(u64, seq, ref->seq) + ) +) + +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_data_ref, + + add_delayed_data_ref, + + btrfs_add_delayed_data_ref, + + TP_PROTO(const struct btrfs_fs_info *fs_info, + const struct btrfs_delayed_ref_node *ref), + + TP_ARGS(fs_info, ref) +) + +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_data_ref, + + run_delayed_data_ref, + + btrfs_run_delayed_data_ref, + + TP_PROTO(const struct btrfs_fs_info *fs_info, + const struct btrfs_delayed_ref_node *ref), + + TP_ARGS(fs_info, ref) +) + +#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0) || \ LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \ LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \ LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \ diff --git a/include/instrumentation/events/mm_vmscan.h b/include/instrumentation/events/mm_vmscan.h index 90addbf3..66eb490c 100644 --- a/include/instrumentation/events/mm_vmscan.h +++ b/include/instrumentation/events/mm_vmscan.h @@ -334,7 +334,8 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_end, ) ) -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,7,0)) +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,7,0) || \ + LTTNG_RHEL_KERNEL_RANGE(5,14,0,427,16,1, 5,15,0,0,0,0)) LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_isolate, TP_PROTO(int classzone_idx, diff --git a/include/instrumentation/events/udp.h b/include/instrumentation/events/udp.h index b63a1bb5..0a94b466 100644 --- a/include/instrumentation/events/udp.h +++ b/include/instrumentation/events/udp.h @@ -7,7 +7,36 @@ #include #include +#include +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,10,0)) +LTTNG_TRACEPOINT_ENUM(lttng_sk_family, + TP_ENUM_VALUES( + ctf_enum_value("AF_INET", AF_INET) + ctf_enum_value("AF_INET6", AF_INET6) + ) +) + +LTTNG_TRACEPOINT_EVENT(udp_fail_queue_rcv_skb, + + TP_PROTO(int rc, struct sock *sk, struct sk_buff *skb), + + TP_ARGS(rc, sk, skb), + + TP_FIELDS( + ctf_integer(int, rc, rc) + ctf_integer(__u16, sport, ntohs(udp_hdr(skb)->source)) + ctf_integer(__u16, dport, ntohs(udp_hdr(skb)->dest)) + ctf_enum(lttng_sk_family, __u16, family, sk->sk_family) + /* + * The 'saddr' and 'daddr' fields from the upstream tracepoint + * are currently not extracted. It is recommended to use a + * tracepoint from the 'net' probe instead which includes all + * fields from the IP header. + */ + ) +) +#else LTTNG_TRACEPOINT_EVENT(udp_fail_queue_rcv_skb, TP_PROTO(int rc, struct sock *sk), @@ -19,6 +48,7 @@ LTTNG_TRACEPOINT_EVENT(udp_fail_queue_rcv_skb, ctf_integer(__u16, lport, inet_sk(sk)->inet_num) ) ) +#endif #endif /* LTTNG_TRACE_UDP_H */ diff --git a/include/instrumentation/syscalls/arm-32-syscalls_pointers_override.h b/include/instrumentation/syscalls/arm-32-syscalls_pointers_override.h index 96fb731f..6c08b794 100644 --- a/include/instrumentation/syscalls/arm-32-syscalls_pointers_override.h +++ b/include/instrumentation/syscalls/arm-32-syscalls_pointers_override.h @@ -31,6 +31,10 @@ #endif /* CONFIG_COMPAT_OLD_SIGACTION */ #endif +/* + * Override 'pipe' to set the output field 'fildes' to an array of 2 integers + * instead of the default integer pointer. + */ #define OVERRIDE_32_pipe SC_LTTNG_TRACEPOINT_EVENT(pipe, TP_PROTO(sc_exit(long ret,) int * fildes), diff --git a/include/instrumentation/syscalls/powerpc-32-syscalls_pointers_override.h b/include/instrumentation/syscalls/powerpc-32-syscalls_pointers_override.h index fde30d27..b0006833 100644 --- a/include/instrumentation/syscalls/powerpc-32-syscalls_pointers_override.h +++ b/include/instrumentation/syscalls/powerpc-32-syscalls_pointers_override.h @@ -4,6 +4,10 @@ #ifndef CREATE_SYSCALL_TABLE +/* + * Override 'pipe' to set the output field 'fildes' to an array of 2 integers + * instead of the default integer pointer. + */ #define OVERRIDE_32_pipe SC_LTTNG_TRACEPOINT_EVENT(pipe, TP_PROTO(sc_exit(long ret,) int * fildes), diff --git a/include/instrumentation/syscalls/syscalls_pointers_override.h b/include/instrumentation/syscalls/syscalls_pointers_override.h index 00e5990c..b3647ecd 100644 --- a/include/instrumentation/syscalls/syscalls_pointers_override.h +++ b/include/instrumentation/syscalls/syscalls_pointers_override.h @@ -193,6 +193,10 @@ SC_LTTNG_TRACEPOINT_EVENT(getcpu, ) ) +/* + * Override 'pipe2' to set the output field 'fildes' to an array of 2 integers + * instead of the default integer pointer. + */ #define OVERRIDE_32_pipe2 #define OVERRIDE_64_pipe2 SC_LTTNG_TRACEPOINT_EVENT(pipe2, @@ -390,6 +394,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 +436,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 +478,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 +708,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 +742,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 +777,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, diff --git a/include/instrumentation/syscalls/x86-32-syscalls_pointers_override.h b/include/instrumentation/syscalls/x86-32-syscalls_pointers_override.h index bd63ed09..63a900f6 100644 --- a/include/instrumentation/syscalls/x86-32-syscalls_pointers_override.h +++ b/include/instrumentation/syscalls/x86-32-syscalls_pointers_override.h @@ -29,6 +29,10 @@ #endif /* CONFIG_COMPAT_OLD_SIGACTION */ #endif +/* + * Override 'pipe' to set the output field 'fildes' to an array of 2 integers + * instead of the default integer pointer. + */ #define OVERRIDE_32_pipe #define OVERRIDE_64_pipe SC_LTTNG_TRACEPOINT_EVENT(pipe, diff --git a/include/instrumentation/syscalls/x86-64-syscalls_pointers_override.h b/include/instrumentation/syscalls/x86-64-syscalls_pointers_override.h index bd889451..e88a97aa 100644 --- a/include/instrumentation/syscalls/x86-64-syscalls_pointers_override.h +++ b/include/instrumentation/syscalls/x86-64-syscalls_pointers_override.h @@ -155,6 +155,10 @@ SC_LTTNG_TRACEPOINT_EVENT_CODE(accept4, TP_code_post() ) +/* + * Override 'pipe' to set the output field 'fildes' to an array of 2 integers + * instead of the default integer pointer. + */ #define OVERRIDE_64_pipe SC_LTTNG_TRACEPOINT_EVENT(pipe, TP_PROTO(sc_exit(long ret,) int * fildes), diff --git a/include/lttng/utils.h b/include/lttng/utils.h index c01b6488..b93ad7b5 100644 --- a/include/lttng/utils.h +++ b/include/lttng/utils.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) */ +/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) */ #ifndef _LTTNG_UTILS_H #define _LTTNG_UTILS_H diff --git a/include/wrapper/fdtable.h b/include/wrapper/fdtable.h index 46fc3f33..d81b4f0b 100644 --- a/include/wrapper/fdtable.h +++ b/include/wrapper/fdtable.h @@ -41,4 +41,18 @@ struct file *lttng_lookup_fdget_rcu(unsigned int fd) } #endif +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,10,0)) +static inline +bool lttng_close_on_exec(unsigned int fd, const struct files_struct *files) +{ + return close_on_exec(fd, files); +} +#else +static inline +bool lttng_close_on_exec(unsigned int fd, const struct files_struct *files) +{ + return close_on_exec(fd, files_fdtable(files)); +} +#endif + #endif /* _LTTNG_WRAPPER_FDTABLE_H */ diff --git a/src/lttng-ring-buffer-event-notifier-client.c b/src/lttng-ring-buffer-event-notifier-client.c index c8dcc1d2..6963d562 100644 --- a/src/lttng-ring-buffer-event-notifier-client.c +++ b/src/lttng-ring-buffer-event-notifier-client.c @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) +/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) * * lttng-ring-buffer-event-notifier-client.c * diff --git a/src/lttng-ring-buffer-event-notifier-client.h b/src/lttng-ring-buffer-event-notifier-client.h index fa7bbf57..6f450eb3 100644 --- a/src/lttng-ring-buffer-event-notifier-client.h +++ b/src/lttng-ring-buffer-event-notifier-client.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) +/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) * * lttng-ring-buffer-event-notifier-client.h * diff --git a/src/lttng-statedump-impl.c b/src/lttng-statedump-impl.c index a0e97e1c..5ea790f5 100644 --- a/src/lttng-statedump-impl.c +++ b/src/lttng-statedump-impl.c @@ -42,7 +42,6 @@ #include #include #include -#include #include /* Define the tracepoints, but do not build the probes */ @@ -436,17 +435,22 @@ int lttng_dump_one_fd(const void *p, struct file *file, unsigned int fd) */ flags &= ~FMODE_NONOTIFY; fdt = files_fdtable(ctx->files); + /* - * We need to check here again whether fd is within the fdt - * max_fds range, because we might be seeing a different - * files_fdtable() than iterate_fd(), assuming only RCU is - * protecting the read. In reality, iterate_fd() holds - * file_lock, which should ensure the fdt does not change while - * the lock is taken, but we are not aware whether this is - * guaranteed or not, so play safe. + * 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. */ - if (fd < fdt->max_fds && close_on_exec(fd, fdt)) + if (WARN_ON_ONCE(fd >= fdt->max_fds)) + return 0; + + if (lttng_close_on_exec(fd, ctx->files)) flags |= O_CLOEXEC; + + /* + * If d_path() failed to get a full path for the file, use the dentry + * name instead to at least get a filename. + */ if (IS_ERR(s)) { struct dentry *dentry = file->f_path.dentry; 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 diff --git a/tools/syscalls/lttng-get-syscall-inout.sh b/tools/syscalls/lttng-get-syscall-inout.sh index 1cf96394..e4c55e9d 100755 --- a/tools/syscalls/lttng-get-syscall-inout.sh +++ b/tools/syscalls/lttng-get-syscall-inout.sh @@ -2,7 +2,7 @@ # SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) # example usage: -# lttng-get-syscall-inout.sh table-syscall-inout.txt select 1 +# lttng-get-syscall-inout.sh arm-64 select 5 1 ARCH_NAME=$1 SYSCALL_NAME=$2 @@ -14,18 +14,23 @@ GENERIC_INOUT_DESCRIPTION_FILE="$(dirname "$0")/table-syscall-inout.txt" # Delete temp file on exit trap 'rm -f "$TMPFILE"' EXIT -if [ "${GENERIC_INOUT_DESCRIPTION_FILE}" = "" ]; then - echo "Error: Please specify input file name as first argument" >&2 +if [ "${ARCH_NAME}" = "" ]; then + echo "Error: Please specify the arch name as first argument" >&2 exit 1 fi if [ "${SYSCALL_NAME}" = "" ]; then - echo "Error: Please specify system call name as second argument" >&2 + echo "Error: Please specify the system call name as second argument" >&2 + exit 1 +fi + +if [[ "${NB_ARGS}" = "" ]]; then + echo "Error: Please specify a number of arguments as third argument" >&2 exit 1 fi if [[ "${ARG_NR}" = "" || ${ARG_NR} == 0 ]]; then - echo "Error: Please specify argument number larger than 0 as third argument" >&2 + echo "Error: Please specify an argument number larger than 0 as fourth argument" >&2 exit 1 fi