Skip to content

Commit

Permalink
ARM: 8022/1: ftrace: work with CONFIG_DEBUG_SET_MODULE_RONX
Browse files Browse the repository at this point in the history
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,
84e1c6b ("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>
  • Loading branch information
Rabin Vincent authored and Russell King committed Apr 23, 2014
1 parent 603fb42 commit a672917
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions arch/arm/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <linux/ftrace.h>
#include <linux/uaccess.h>
#include <linux/module.h>

#include <asm/cacheflush.h>
#include <asm/opcodes.h>
Expand Down Expand Up @@ -63,6 +64,18 @@ static unsigned long adjust_address(struct dyn_ftrace *rec, unsigned long addr)
}
#endif

int ftrace_arch_code_modify_prepare(void)
{
set_all_modules_text_rw();
return 0;
}

int ftrace_arch_code_modify_post_process(void)
{
set_all_modules_text_ro();
return 0;
}

static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr)
{
return arm_gen_branch_link(pc, addr);
Expand Down

0 comments on commit a672917

Please sign in to comment.