diff options
Diffstat (limited to 'kernel/extable.c')
-rw-r--r-- | kernel/extable.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/kernel/extable.c b/kernel/extable.c index b54a6017b6b5..7f8f263f8524 100644 --- a/kernel/extable.c +++ b/kernel/extable.c | |||
@@ -52,6 +52,14 @@ const struct exception_table_entry *search_exception_tables(unsigned long addr) | |||
52 | return e; | 52 | return e; |
53 | } | 53 | } |
54 | 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 | |||
55 | int core_kernel_text(unsigned long addr) | 63 | int core_kernel_text(unsigned long addr) |
56 | { | 64 | { |
57 | if (addr >= (unsigned long)_stext && | 65 | if (addr >= (unsigned long)_stext && |
@@ -59,8 +67,7 @@ int core_kernel_text(unsigned long addr) | |||
59 | return 1; | 67 | return 1; |
60 | 68 | ||
61 | if (system_state == SYSTEM_BOOTING && | 69 | if (system_state == SYSTEM_BOOTING && |
62 | addr >= (unsigned long)_sinittext && | 70 | init_kernel_text(addr)) |
63 | addr <= (unsigned long)_einittext) | ||
64 | return 1; | 71 | return 1; |
65 | return 0; | 72 | return 0; |
66 | } | 73 | } |
@@ -69,14 +76,26 @@ int __kernel_text_address(unsigned long addr) | |||
69 | { | 76 | { |
70 | if (core_kernel_text(addr)) | 77 | if (core_kernel_text(addr)) |
71 | return 1; | 78 | return 1; |
72 | 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; | ||
73 | } | 92 | } |
74 | 93 | ||
75 | int kernel_text_address(unsigned long addr) | 94 | int kernel_text_address(unsigned long addr) |
76 | { | 95 | { |
77 | if (core_kernel_text(addr)) | 96 | if (core_kernel_text(addr)) |
78 | return 1; | 97 | return 1; |
79 | return module_text_address(addr) != NULL; | 98 | return is_module_text_address(addr); |
80 | } | 99 | } |
81 | 100 | ||
82 | /* | 101 | /* |
@@ -92,5 +111,5 @@ int func_ptr_is_kernel_text(void *ptr) | |||
92 | addr = (unsigned long) dereference_function_descriptor(ptr); | 111 | addr = (unsigned long) dereference_function_descriptor(ptr); |
93 | if (core_kernel_text(addr)) | 112 | if (core_kernel_text(addr)) |
94 | return 1; | 113 | return 1; |
95 | return module_text_address(addr) != NULL; | 114 | return is_module_text_address(addr); |
96 | } | 115 | } |