return ptr_block_class;
}
+/*
+ * Canary function to check for 'block_class' at compile time.
+ *
+ * From 'include/linux/genhd.h':
+ *
+ * extern struct class block_class;
+ */
+static inline
+struct class *__canary__get_block_class(void)
+{
+ return &block_class;
+}
+
static inline
struct device_type *wrapper_get_disk_type(void)
{
return ptr_disk_type;
}
+/*
+ * No canary for 'disk_type', it's only defined in 'block/genhd.c'.
+ *
+ * static inline
+ * struct device_type *__canary__get_disk_type(void)
+ * {
+ * return &disk_type;
+ * }
+ */
+
#else
static inline
struct irq_desc *wrapper_irq_to_desc(unsigned int irq);
+/*
+ * Canary function to check for 'irq_to_desc()' at compile time.
+ *
+ * From 'include/linux/irqnr.h':
+ *
+ * extern struct irq_desc *irq_to_desc(unsigned int irq);
+ */
+static inline
+struct irq_desc *__canary__irq_to_desc(unsigned int irq)
+{
+ return irq_to_desc(irq);
+}
+
#endif /* _LTTNG_WRAPPER_IRQDESC_H */
}
}
+/*
+ * No canary for 'tracepoint_module_notify()', it's only defined in 'kernel/tracepoint.c'.
+ *
+ * static inline
+ * int __canary__tracepoint_module_notify(struct notifier_block *nb,
+ * unsigned long val, struct module *mod)
+ * {
+ * return tracepoint_module_notify(nb, val, mod);
+ * }
+ */
+
#endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) && defined(CONFIG_MODULE_SIG)) */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) && defined(CONFIG_MODULE_SIG) && defined(MODULE))
}
}
+/*
+ * Canary function to check for 'uprobe_register()' at compile time.
+ *
+ * From 'include/linux/uprobes.h':
+ *
+ * extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
+ */
+static inline
+int __canary__uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
+{
+ return uprobe_register(inode, offset, uc);
+}
+
static inline
void wrapper_uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
{
WARN_ON(1);
}
}
+
+/*
+ * Canary function to check for 'uprobe_unregister()' at compile time.
+ *
+ * From 'include/linux/uprobes.h':
+ *
+ * extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
+ */
+static inline
+int __canary__uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
+{
+ return uprobe_unregister(inode, offset, uc);
+}
+
#endif
#else
/* Version < 3.5, before uprobe was added. */
}
}
+/*
+ * Canary function to check for 'vmalloc_sync_mappings()' at compile time.
+ *
+ * From 'include/linux/vmalloc.h':
+ *
+ * void vmalloc_sync_mappings(void);
+ */
+static inline
+void __canary__vmalloc_sync_mappings(void)
+{
+ vmalloc_sync_mappings();
+}
+
#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) */
/*
- * Map vmalloc_sync_mappings to vmalloc_sync_all() on kernels before 5.7.
+ * Map vmalloc_sync_mappings to vmalloc_sync_all() on kernels before 5.6.
*/
static inline
void wrapper_vmalloc_sync_mappings(void)
}
}
+/*
+ * Canary function to check for 'vmalloc_sync_all()' at compile time.
+ *
+ * From 'include/linux/vmalloc.h':
+ *
+ * void vmalloc_sync_all(void);
+ */
+static inline
+void __canary__vmalloc_sync_all(void)
+{
+ vmalloc_sync_all();
+}
+
#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) */
#else
return __vmalloc(size, gfp_mask, prot);
}
+/*
+ * Canary function to check for '__vmalloc_node_range()' at compile time.
+ *
+ * From 'include/linux/vmalloc.h':
+ *
+ * extern void *__vmalloc_node_range(unsigned long size, unsigned long align,
+ * unsigned long start, unsigned long end, gfp_t gfp_mask,
+ * pgprot_t prot, unsigned long vm_flags, int node,
+ * const void *caller);
+ */
+static inline
+void *__canary____lttng_vmalloc_node_range(unsigned long size, unsigned long align,
+ unsigned long start, unsigned long end, gfp_t gfp_mask,
+ pgprot_t prot, unsigned long vm_flags, int node,
+ const void *caller)
+{
+ return __vmalloc_node_range(size, align, start, end, gfp_mask, prot,
+ vm_flags, node, caller);
+}
+
/**
* lttng_kvmalloc_node - attempt to allocate physically contiguous memory, but upon
* failure, fall back to non-contiguous (vmalloc) allocation.
return 0;
}
}
+
+/*
+ * Canary function to check for 'global_wb_domain' at compile time.
+ *
+ * From 'include/linux/writeback.h':
+ *
+ * extern struct wb_domain global_wb_domain;
+ */
+static inline
+unsigned long __canary__global_wb_domain(void)
+{
+ return global_wb_domain.dirty_limit;
+}
+
#else
static unsigned long *global_dirty_limit_sym;
return 0;
}
}
+
+/*
+ * Canary function to check for 'global_dirty_limit' at compile time.
+ *
+ * From 'include/linux/writeback.h':
+ *
+ * extern unsigned long global_dirty_limit;
+ */
+static inline
+unsigned long __canary__global_dirty_limit(void)
+{
+ return global_dirty_limit;
+}
+
#endif
#else /* CONFIG_KALLSYMS_ALL */
return 0;
}
+/*
+ * Canary function to check for 'task_prio()' at compile time.
+ *
+ * From 'include/linux/sched.h':
+ *
+ * extern int task_prio(const struct task_struct *p);
+ */
+__attribute__((unused)) static
+int __canary__task_prio(const struct task_struct *p)
+{
+ return task_prio(p);
+}
+
static
size_t prio_get_size(size_t offset)
{
}
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 <linux/pageblock-flags.h>
}
}
+/*
+ * Canary function to check for 'splice_to_pipe()' at compile time.
+ *
+ * From 'include/linux/splice.h':
+ *
+ * extern ssize_t splice_to_pipe(struct pipe_inode_info *,
+ * struct splice_pipe_desc *spd);
+ */
+__attribute__((unused)) static
+ssize_t __canary__splice_to_pipe(struct pipe_inode_info *pipe,
+ struct splice_pipe_desc *spd)
+{
+ return splice_to_pipe(pipe, spd);
+}
+
#else
#include <linux/fs.h>