Commit be993e44 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

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: default avatarDmitry Osipenko <digetx@gmail.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Tested-by: default avatarDmitry Osipenko <digetx@gmail.com>
parent 0a679e13
...@@ -78,13 +78,10 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old, ...@@ -78,13 +78,10 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old,
{ {
unsigned long replaced; unsigned long replaced;
if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) { if (IS_ENABLED(CONFIG_THUMB2_KERNEL))
old = __opcode_to_mem_thumb32(old); old = __opcode_to_mem_thumb32(old);
new = __opcode_to_mem_thumb32(new); else
} else {
old = __opcode_to_mem_arm(old); old = __opcode_to_mem_arm(old);
new = __opcode_to_mem_arm(new);
}
if (validate) { if (validate) {
if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE)) if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment