ARM: Set bit 0 for thumb mode in kallsyms_lookup_name returned address
authorAvik Sil <avik.sil@linaro.org>
Mon, 19 Sep 2011 14:59:59 +0000 (10:59 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 19 Sep 2011 14:59:59 +0000 (10:59 -0400)
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 <avik.sil@linaro.org>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-context-prio.c
wrapper/ftrace.h
wrapper/splice.c
wrapper/vmalloc.h

index ad1c42f43ef5d56ed638ec76087ff1048b2b2992..1ee3a54daf2c33b331a1a3d97e247478b8a65679 100644 (file)
@@ -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;
index 9c18cc5648424667f5a907a1170e2714685ce651..ace33c54100daf91235b611ee275d4727d4c575e 100644 (file)
@@ -16,6 +16,7 @@
 #ifdef CONFIG_KALLSYMS
 
 #include <linux/kallsyms.h>
+#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 {
index edc499c835efd2278e128d37d6ab8be5d8fb322c..ba224eea62fb39b9ba6a0bcb84b1e1d1dc53305e 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/kallsyms.h>
 #include <linux/fs.h>
 #include <linux/splice.h>
+#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 {
index 7d878556b4437164a7505a355c6dc1577a2910b3..765f2ad9e22564b18e6d11b1e4dcc824dcf01cdf 100644 (file)
 #ifdef CONFIG_KALLSYMS
 
 #include <linux/kallsyms.h>
+#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 {
This page took 0.028053 seconds and 4 git commands to generate.