diff options
Diffstat (limited to 'kernel/extable.c')
-rw-r--r-- | kernel/extable.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/kernel/extable.c b/kernel/extable.c index 25d39b0c3a1b..7f8f263f8524 100644 --- a/kernel/extable.c +++ b/kernel/extable.c | |||
@@ -16,6 +16,7 @@ | |||
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 | */ | 17 | */ |
18 | #include <linux/ftrace.h> | 18 | #include <linux/ftrace.h> |
19 | #include <linux/memory.h> | ||
19 | #include <linux/module.h> | 20 | #include <linux/module.h> |
20 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
21 | #include <linux/init.h> | 22 | #include <linux/init.h> |
@@ -51,6 +52,14 @@ const struct exception_table_entry *search_exception_tables(unsigned long addr) | |||
51 | return e; | 52 | return e; |
52 | } | 53 | } |
53 | 54 | ||
55 | static inline int init_kernel_text(unsigned long addr) | ||
56 | { | ||
57 | if (addr >= (unsigned long)_sinittext && | ||
58 | addr <= (unsigned long)_einittext) | ||
59 | return 1; | ||
60 | return 0; | ||
61 | } | ||
62 | |||
54 | int core_kernel_text(unsigned long addr) | 63 | int core_kernel_text(unsigned long addr) |
55 | { | 64 | { |
56 | if (addr >= (unsigned long)_stext && | 65 | if (addr >= (unsigned long)_stext && |
@@ -58,8 +67,7 @@ int core_kernel_text(unsigned long addr) | |||
58 | return 1; | 67 | return 1; |
59 | 68 | ||
60 | if (system_state == SYSTEM_BOOTING && | 69 | if (system_state == SYSTEM_BOOTING && |
61 | addr >= (unsigned long)_sinittext && | 70 | init_kernel_text(addr)) |
62 | addr <= (unsigned long)_einittext) | ||
63 | return 1; | 71 | return 1; |
64 | return 0; | 72 | return 0; |
65 | } | 73 | } |
@@ -68,14 +76,26 @@ int __kernel_text_address(unsigned long addr) | |||
68 | { | 76 | { |
69 | if (core_kernel_text(addr)) | 77 | if (core_kernel_text(addr)) |
70 | return 1; | 78 | return 1; |
71 | return __module_text_address(addr) != NULL; | 79 | if (is_module_text_address(addr)) |
80 | return 1; | ||
81 | /* | ||
82 | * There might be init symbols in saved stacktraces. | ||
83 | * Give those symbols a chance to be printed in | ||
84 | * backtraces (such as lockdep traces). | ||
85 | * | ||
86 | * Since we are after the module-symbols check, there's | ||
87 | * no danger of address overlap: | ||
88 | */ | ||
89 | if (init_kernel_text(addr)) | ||
90 | return 1; | ||
91 | return 0; | ||
72 | } | 92 | } |
73 | 93 | ||
74 | int kernel_text_address(unsigned long addr) | 94 | int kernel_text_address(unsigned long addr) |
75 | { | 95 | { |
76 | if (core_kernel_text(addr)) | 96 | if (core_kernel_text(addr)) |
77 | return 1; | 97 | return 1; |
78 | return module_text_address(addr) != NULL; | 98 | return is_module_text_address(addr); |
79 | } | 99 | } |
80 | 100 | ||
81 | /* | 101 | /* |
@@ -91,5 +111,5 @@ int func_ptr_is_kernel_text(void *ptr) | |||
91 | addr = (unsigned long) dereference_function_descriptor(ptr); | 111 | addr = (unsigned long) dereference_function_descriptor(ptr); |
92 | if (core_kernel_text(addr)) | 112 | if (core_kernel_text(addr)) |
93 | return 1; | 113 | return 1; |
94 | return module_text_address(addr) != NULL; | 114 | return is_module_text_address(addr); |
95 | } | 115 | } |