#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,5,0))
#include <linux/uprobes.h>
+/*
+ * No wrappers for >= 6.12, the API has changed too much, the version checks
+ * are inlined in 'src/probes/lttng-uprobes.c'.
+ */
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,12,0))
/* Use kallsym lookup for version before 3.9. */
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
static inline
int wrapper_uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
goto register_error;
}
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,12,0))
+ ret = 0;
+ uprobe_handler->uprobe = uprobe_register(uprobe->inode,
+ uprobe_handler->offset, 0, &uprobe_handler->up_consumer);
+ if (IS_ERR(uprobe_handler->uprobe))
+ ret = -1;
+#else
ret = wrapper_uprobe_register(uprobe->inode,
uprobe_handler->offset, &uprobe_handler->up_consumer);
+#endif
if (ret) {
printk(KERN_WARNING "LTTng: Error registering probe on inode %lu "
"and offset 0x%llx\n", uprobe->inode->i_ino,
{
struct lttng_uprobe_handler *iter, *tmp;
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,12,0))
+ /*
+ * Iterate over the list of handler, unregister each uprobe.
+ */
+ list_for_each_entry(iter, head, node) {
+ uprobe_unregister_nosync(iter->uprobe, &iter->up_consumer);
+ iter->uprobe = NULL;
+ }
+
+ /*
+ * Call synchronize_srcu() on uprobes_srcu.
+ */
+ uprobe_unregister_sync();
+
/*
* Iterate over the list of handler, remove each handler from the list
* and free the struct.
*/
+ list_for_each_entry_safe(iter, tmp, head, node) {
+ list_del(&iter->node);
+ kfree(iter);
+ }
+#else
+ /*
+ * Iterate over the list of handler, unregister each uprobe, remove
+ * each handler from the list and free the struct.
+ */
list_for_each_entry_safe(iter, tmp, head, node) {
wrapper_uprobe_unregister(inode, iter->offset, &iter->up_consumer);
list_del(&iter->node);
kfree(iter);
}
+#endif
}
void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event_recorder)