aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/ftrace.c
diff options
context:
space:
mode:
authorRabin Vincent <rabin@rab.in>2014-04-03 13:46:45 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-04-22 20:24:31 -0400
commita672917ab8964228f83ac1f0728468b309d6ea19 (patch)
tree460597a22423320189d38bebb8b8b408ad46f990 /arch/arm/kernel/ftrace.c
parent603fb42a66499ab353466c7afa3d38beea20a8a9 (diff)
ARM: 8022/1: ftrace: work with CONFIG_DEBUG_SET_MODULE_RONX
Make ftrace work with CONFIG_DEBUG_SET_MODULE_RONX by making module text writable around the place where ftrace does its work, like it is done on x86 in the patch which introduced CONFIG_DEBUG_SET_MODULE_RONX, 84e1c6bb38eb ("x86: Add RO/NX protection for loadable kernel modules"). Tested-by: Mitchel Humpherys <mitchelh@codeaurora.org> Signed-off-by: Rabin Vincent <rabin@rab.in> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/ftrace.c')
-rw-r--r--arch/arm/kernel/ftrace.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
index c108ddcb9ba4..af9a8a927a4e 100644
--- a/arch/arm/kernel/ftrace.c
+++ b/arch/arm/kernel/ftrace.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/ftrace.h> 15#include <linux/ftrace.h>
16#include <linux/uaccess.h> 16#include <linux/uaccess.h>
17#include <linux/module.h>
17 18
18#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
19#include <asm/opcodes.h> 20#include <asm/opcodes.h>
@@ -63,6 +64,18 @@ static unsigned long adjust_address(struct dyn_ftrace *rec, unsigned long addr)
63} 64}
64#endif 65#endif
65 66
67int ftrace_arch_code_modify_prepare(void)
68{
69 set_all_modules_text_rw();
70 return 0;
71}
72
73int ftrace_arch_code_modify_post_process(void)
74{
75 set_all_modules_text_ro();
76 return 0;
77}
78
66static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr) 79static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr)
67{ 80{
68 return arm_gen_branch_link(pc, addr); 81 return arm_gen_branch_link(pc, addr);