From: Avik Sil Date: Mon, 19 Sep 2011 14:59:59 +0000 (-0400) Subject: ARM: Set bit 0 for thumb mode in kallsyms_lookup_name returned address X-Git-Tag: v2.0-pre9~29 X-Git-Url: http://git.liburcu.org/?p=lttng-modules.git;a=commitdiff_plain;h=c539a324b020171c10d0fcb100892ac93c17e9e7 ARM: Set bit 0 for thumb mode in kallsyms_lookup_name returned address This patch fixes the undefined instruction oops due to execution of thumb-2 code in ARM mode. The zero bit in the symbol address returned by kallsyms_lookup_name is not set, leading to switching to ARM mode that generates oops while executing thumb-2 code. For detailed discussion, see [1]. [1] http://lists.casi.polymtl.ca/pipermail/ltt-dev/2011-September/005176.html v1: - include wrapper function kallsyms_lookup_funcptr as suggested by Dave Martin Signed-off-by: Avik Sil Signed-off-by: Mathieu Desnoyers --- diff --git a/lttng-context-prio.c b/lttng-context-prio.c index ad1c42f4..1ee3a54d 100644 --- a/lttng-context-prio.c +++ b/lttng-context-prio.c @@ -13,6 +13,7 @@ #include "ltt-events.h" #include "wrapper/ringbuffer/frontend_types.h" #include "wrapper/vmalloc.h" +#include "wrapper/kallsyms.h" #include "ltt-tracer.h" static @@ -20,7 +21,7 @@ int (*wrapper_task_prio_sym)(struct task_struct *t); int wrapper_task_prio_init(void) { - wrapper_task_prio_sym = (void *) kallsyms_lookup_name("task_prio"); + wrapper_task_prio_sym = (void *) kallsyms_lookup_funcptr("task_prio"); if (!wrapper_task_prio_sym) { printk(KERN_WARNING "LTTng: task_prio symbol lookup failed.\n"); return -EINVAL; diff --git a/wrapper/ftrace.h b/wrapper/ftrace.h index 9c18cc56..ace33c54 100644 --- a/wrapper/ftrace.h +++ b/wrapper/ftrace.h @@ -16,6 +16,7 @@ #ifdef CONFIG_KALLSYMS #include +#include "kallsyms.h" static inline int wrapper_register_ftrace_function_probe(char *glob, @@ -24,7 +25,7 @@ int wrapper_register_ftrace_function_probe(char *glob, int (*register_ftrace_function_probe_sym)(char *glob, struct ftrace_probe_ops *ops, void *data); - register_ftrace_function_probe_sym = (void *) kallsyms_lookup_name("register_ftrace_function_probe"); + register_ftrace_function_probe_sym = (void *) kallsyms_lookup_funcptr("register_ftrace_function_probe"); if (register_ftrace_function_probe_sym) { return register_ftrace_function_probe_sym(glob, ops, data); } else { @@ -40,7 +41,7 @@ void wrapper_unregister_ftrace_function_probe(char *glob, void (*unregister_ftrace_function_probe_sym)(char *glob, struct ftrace_probe_ops *ops, void *data); - unregister_ftrace_function_probe_sym = (void *) kallsyms_lookup_name("unregister_ftrace_function_probe"); + unregister_ftrace_function_probe_sym = (void *) kallsyms_lookup_funcptr("unregister_ftrace_function_probe"); if (unregister_ftrace_function_probe_sym) { unregister_ftrace_function_probe_sym(glob, ops, data); } else { diff --git a/wrapper/splice.c b/wrapper/splice.c index edc499c8..ba224eea 100644 --- a/wrapper/splice.c +++ b/wrapper/splice.c @@ -13,6 +13,7 @@ #include #include #include +#include "kallsyms.h" static ssize_t (*splice_to_pipe_sym)(struct pipe_inode_info *pipe, @@ -22,7 +23,7 @@ ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe, struct splice_pipe_desc *spd) { if (!splice_to_pipe_sym) - splice_to_pipe_sym = (void *) kallsyms_lookup_name("splice_to_pipe"); + splice_to_pipe_sym = (void *) kallsyms_lookup_funcptr("splice_to_pipe"); if (splice_to_pipe_sym) { return splice_to_pipe_sym(pipe, spd); } else { diff --git a/wrapper/vmalloc.h b/wrapper/vmalloc.h index 7d878556..765f2ad9 100644 --- a/wrapper/vmalloc.h +++ b/wrapper/vmalloc.h @@ -14,13 +14,14 @@ #ifdef CONFIG_KALLSYMS #include +#include "kallsyms.h" static inline void wrapper_vmalloc_sync_all(void) { void (*vmalloc_sync_all_sym)(void); - vmalloc_sync_all_sym = (void *) kallsyms_lookup_name("vmalloc_sync_all"); + vmalloc_sync_all_sym = (void *) kallsyms_lookup_funcptr("vmalloc_sync_all"); if (vmalloc_sync_all_sym) { vmalloc_sync_all_sym(); } else {