Fix: OOT lttng-statedump tracepoints not visible with signed kernels
[lttng-modules.git] / wrapper / tracepoint.h
CommitLineData
3a523f5b
MD
1#ifndef _LTTNG_WRAPPER_TRACEPOINT_H
2#define _LTTNG_WRAPPER_TRACEPOINT_H
3
4/*
5 * wrapper/tracepoint.h
6 *
7 * wrapper around DECLARE_EVENT_CLASS.
8 *
9 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; only
14 * version 2.1 of the License.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26#include <linux/version.h>
27#include <linux/tracepoint.h>
9f9f9409 28#include <linux/module.h>
3a523f5b
MD
29
30#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
31
32#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
33
34#endif
35
36#ifndef HAVE_KABI_2635_TRACEPOINT
37
38#define kabi_2635_tracepoint_probe_register tracepoint_probe_register
39#define kabi_2635_tracepoint_probe_unregister tracepoint_probe_unregister
40#define kabi_2635_tracepoint_probe_register_noupdate tracepoint_probe_register_noupdate
41#define kabi_2635_tracepoint_probe_unregister_noupdate tracepoint_probe_unregister_noupdate
42
43#endif /* HAVE_KABI_2635_TRACEPOINT */
44
9f9f9409
MD
45#ifdef CONFIG_MODULE_SIG
46
47#include <linux/kallsyms.h>
48#include "kallsyms.h"
49
50static inline
51int wrapper_tracepoint_module_notify(struct notifier_block *nb,
52 unsigned long val, struct module *mod)
53{
54 int (*tracepoint_module_notify_sym)(struct notifier_block *nb,
55 unsigned long val, struct module *mod);
56
57 tracepoint_module_notify_sym =
58 (void *) kallsyms_lookup_funcptr("tracepoint_module_notify");
59 if (tracepoint_module_notify_sym) {
60 return tracepoint_module_notify_sym(nb, val, mod);
61 } else {
62 printk(KERN_WARNING "LTTng: tracepoint_module_notify symbol lookup failed.\n");
63 return -ENOSYS;
64 }
65}
66
67static inline
68int wrapper_lttng_fixup_sig(struct module *mod)
69{
70 int ret = 0;
71
72 /*
73 * This is for module.c confusing force loaded modules with
74 * unsigned modules.
75 */
76 if (!THIS_MODULE->sig_ok &&
77 THIS_MODULE->taints & (1U << TAINT_FORCED_MODULE)) {
78 THIS_MODULE->taints &= ~(1U << TAINT_FORCED_MODULE);
79 ret = wrapper_tracepoint_module_notify(NULL,
80 MODULE_STATE_COMING, mod);
81 THIS_MODULE->taints |= (1U << TAINT_FORCED_MODULE);
82 }
83 return ret;
84}
85
86#else /* CONFIG_MODULE_SIG */
87
88static inline
89int wrapper_lttng_fixup_sig(struct module *mod)
90{
91 return 0;
92}
93
94#endif /* #else CONFIG_MODULE_SIG */
95
3a523f5b 96#endif /* _LTTNG_WRAPPER_TRACEPOINT_H */
This page took 0.026359 seconds and 4 git commands to generate.