1 /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
5 * wrapper around uprobes. Using KALLSYMS to get its address when
6 * available, else we need to have a kernel that exports this function to GPL
9 * Copyright (C) 2013 Yannick Brosseau <yannick.brosseau@gmail.com>
10 * Copyright (C) 2017 Francis Deslauriers <francis.deslauriers@efficios.com>
14 #ifndef _LTTNG_WRAPPER_UPROBES_H
15 #define _LTTNG_WRAPPER_UPROBES_H
17 #include <linux/version.h>
19 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
20 #include <linux/uprobes.h>
22 /* Use kallsym lookup for version before 3.9. */
23 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
26 int wrapper_uprobe_register(struct inode
*inode
, loff_t offset
, struct uprobe_consumer
*uc
)
28 return uprobe_register(inode
, offset
, uc
);
32 void wrapper_uprobe_unregister(struct inode
*inode
, loff_t offset
, struct uprobe_consumer
*uc
)
34 uprobe_unregister(inode
, offset
, uc
);
37 #else /* Version < 3.9, use kallsym lookup. */
41 int wrapper_uprobe_register(struct inode
*inode
, loff_t offset
, struct uprobe_consumer
*uc
)
43 int (*uprobe_register_sym
)(struct inode
*inode
, loff_t offset
, struct uprobe_consumer
*uc
);
45 uprobe_register_sym
= (void *) kallsyms_lookup_funcptr("uprobe_register");
47 if (uprobe_register_sym
) {
48 return uprobe_register_sym(inode
, offset
, uc
);
50 printk(KERN_WARNING
"LTTng: uprobe_register symbol lookup failed.\n");
56 void wrapper_uprobe_unregister(struct inode
*inode
, loff_t offset
, struct uprobe_consumer
*uc
)
58 int (*uprobe_unregister_sym
)(struct inode
*inode
, loff_t offset
, struct uprobe_consumer
*uc
);
60 uprobe_unregister_sym
= (void *) kallsyms_lookup_funcptr("uprobe_unregister");
62 if (uprobe_unregister_sym
) {
63 uprobe_unregister_sym(inode
, offset
, uc
);
65 printk(KERN_WARNING
"LTTng: uprobe_unregister symbol lookup failed.\n");
71 /* Version < 3.5, before uprobe was added. */
72 struct uprobe_consumer
{};
This page took 0.031978 seconds and 4 git commands to generate.