X-Git-Url: http://git.liburcu.org/?p=lttng-modules.git;a=blobdiff_plain;f=wrapper%2Ftracepoint.h;fp=wrapper%2Ftracepoint.h;h=60b36856e724e9b04125e6ef0970ed17939c4a63;hp=798d785b1accc1ae2a703e509c6aa322aeb76860;hb=9f9f9409940c104e29db62fc3381697fcc1d490d;hpb=75b37e1061cfe57a50b9ca7cbf40f6e53ec9d1c2 diff --git a/wrapper/tracepoint.h b/wrapper/tracepoint.h index 798d785b..60b36856 100644 --- a/wrapper/tracepoint.h +++ b/wrapper/tracepoint.h @@ -25,6 +25,7 @@ #include #include +#include #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) @@ -41,4 +42,55 @@ #endif /* HAVE_KABI_2635_TRACEPOINT */ +#ifdef CONFIG_MODULE_SIG + +#include +#include "kallsyms.h" + +static inline +int wrapper_tracepoint_module_notify(struct notifier_block *nb, + unsigned long val, struct module *mod) +{ + int (*tracepoint_module_notify_sym)(struct notifier_block *nb, + unsigned long val, struct module *mod); + + tracepoint_module_notify_sym = + (void *) kallsyms_lookup_funcptr("tracepoint_module_notify"); + if (tracepoint_module_notify_sym) { + return tracepoint_module_notify_sym(nb, val, mod); + } else { + printk(KERN_WARNING "LTTng: tracepoint_module_notify symbol lookup failed.\n"); + return -ENOSYS; + } +} + +static inline +int wrapper_lttng_fixup_sig(struct module *mod) +{ + int ret = 0; + + /* + * This is for module.c confusing force loaded modules with + * unsigned modules. + */ + if (!THIS_MODULE->sig_ok && + THIS_MODULE->taints & (1U << TAINT_FORCED_MODULE)) { + THIS_MODULE->taints &= ~(1U << TAINT_FORCED_MODULE); + ret = wrapper_tracepoint_module_notify(NULL, + MODULE_STATE_COMING, mod); + THIS_MODULE->taints |= (1U << TAINT_FORCED_MODULE); + } + return ret; +} + +#else /* CONFIG_MODULE_SIG */ + +static inline +int wrapper_lttng_fixup_sig(struct module *mod) +{ + return 0; +} + +#endif /* #else CONFIG_MODULE_SIG */ + #endif /* _LTTNG_WRAPPER_TRACEPOINT_H */