diff options
Diffstat (limited to 'kernel/extable.c')
| -rw-r--r-- | kernel/extable.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/kernel/extable.c b/kernel/extable.c index c46da6a47036..7f8f263f8524 100644 --- a/kernel/extable.c +++ b/kernel/extable.c | |||
| @@ -15,11 +15,22 @@ | |||
| 15 | along with this program; if not, write to the Free Software | 15 | along with this program; if not, write to the Free Software |
| 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> | ||
| 19 | #include <linux/memory.h> | ||
| 18 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 21 | #include <linux/mutex.h> | ||
| 19 | #include <linux/init.h> | 22 | #include <linux/init.h> |
| 20 | #include <linux/ftrace.h> | 23 | |
| 21 | #include <asm/uaccess.h> | ||
| 22 | #include <asm/sections.h> | 24 | #include <asm/sections.h> |
| 25 | #include <asm/uaccess.h> | ||
| 26 | |||
| 27 | /* | ||
| 28 | * mutex protecting text section modification (dynamic code patching). | ||
| 29 | * some users need to sleep (allocating memory...) while they hold this lock. | ||
| 30 | * | ||
| 31 | * NOT exported to modules - patching kernel text is a really delicate matter. | ||
| 32 | */ | ||
| 33 | DEFINE_MUTEX(text_mutex); | ||
| 23 | 34 | ||
| 24 | extern struct exception_table_entry __start___ex_table[]; | 35 | extern struct exception_table_entry __start___ex_table[]; |
| 25 | extern struct exception_table_entry __stop___ex_table[]; | 36 | extern struct exception_table_entry __stop___ex_table[]; |
| @@ -49,7 +60,7 @@ static inline int init_kernel_text(unsigned long addr) | |||
| 49 | return 0; | 60 | return 0; |
| 50 | } | 61 | } |
| 51 | 62 | ||
| 52 | __notrace_funcgraph int core_kernel_text(unsigned long addr) | 63 | int core_kernel_text(unsigned long addr) |
| 53 | { | 64 | { |
| 54 | if (addr >= (unsigned long)_stext && | 65 | if (addr >= (unsigned long)_stext && |
| 55 | addr <= (unsigned long)_etext) | 66 | addr <= (unsigned long)_etext) |
| @@ -61,11 +72,11 @@ __notrace_funcgraph int core_kernel_text(unsigned long addr) | |||
| 61 | return 0; | 72 | return 0; |
| 62 | } | 73 | } |
| 63 | 74 | ||
| 64 | __notrace_funcgraph int __kernel_text_address(unsigned long addr) | 75 | int __kernel_text_address(unsigned long addr) |
| 65 | { | 76 | { |
| 66 | if (core_kernel_text(addr)) | 77 | if (core_kernel_text(addr)) |
| 67 | return 1; | 78 | return 1; |
| 68 | if (__module_text_address(addr)) | 79 | if (is_module_text_address(addr)) |
| 69 | return 1; | 80 | return 1; |
| 70 | /* | 81 | /* |
| 71 | * There might be init symbols in saved stacktraces. | 82 | * There might be init symbols in saved stacktraces. |
| @@ -84,7 +95,7 @@ int kernel_text_address(unsigned long addr) | |||
| 84 | { | 95 | { |
| 85 | if (core_kernel_text(addr)) | 96 | if (core_kernel_text(addr)) |
| 86 | return 1; | 97 | return 1; |
| 87 | return module_text_address(addr) != NULL; | 98 | return is_module_text_address(addr); |
| 88 | } | 99 | } |
| 89 | 100 | ||
| 90 | /* | 101 | /* |
| @@ -100,5 +111,5 @@ int func_ptr_is_kernel_text(void *ptr) | |||
| 100 | addr = (unsigned long) dereference_function_descriptor(ptr); | 111 | addr = (unsigned long) dereference_function_descriptor(ptr); |
| 101 | if (core_kernel_text(addr)) | 112 | if (core_kernel_text(addr)) |
| 102 | return 1; | 113 | return 1; |
| 103 | return module_text_address(addr) != NULL; | 114 | return is_module_text_address(addr); |
| 104 | } | 115 | } |
