diff options
author | Peter Zijlstra <peterz@infradead.org> | 2020-02-07 12:57:36 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2020-02-11 12:56:26 +0100 |
commit | be993e44badc448add6a18d6f12b20615692c4c3 (patch) | |
tree | e1fb23b396ab0d64257bdd8796808c1db05e3f92 /arch | |
parent | 0a679e13ea30f85a1aef0669ee0c5a9fd7860b34 (diff) | |
download | linux-be993e44badc448add6a18d6f12b20615692c4c3.tar.gz linux-be993e44badc448add6a18d6f12b20615692c4c3.tar.bz2 linux-be993e44badc448add6a18d6f12b20615692c4c3.zip |
arm/ftrace: Fix BE text poking
The __patch_text() function already applies __opcode_to_mem_*(), so
when __opcode_to_mem_*() is not the identity (BE*), it is applied
twice, wrecking the instruction.
Fixes: 42e51f187f86 ("arm/ftrace: Use __patch_text()")
Reported-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/kernel/ftrace.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c index 2a5ff69c28e6..10499d44964a 100644 --- a/arch/arm/kernel/ftrace.c +++ b/arch/arm/kernel/ftrace.c @@ -78,13 +78,10 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old, { unsigned long replaced; - if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) { + if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) old = __opcode_to_mem_thumb32(old); - new = __opcode_to_mem_thumb32(new); - } else { + else old = __opcode_to_mem_arm(old); - new = __opcode_to_mem_arm(new); - } if (validate) { if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE)) |