Skip to content

Commit be993e4

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
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: 42e51f1 ("arm/ftrace: Use __patch_text()") Reported-by: Dmitry Osipenko <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Tested-by: Dmitry Osipenko <[email protected]>
1 parent 0a679e1 commit be993e4

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

arch/arm/kernel/ftrace.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,10 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old,
7878
{
7979
unsigned long replaced;
8080

81-
if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) {
81+
if (IS_ENABLED(CONFIG_THUMB2_KERNEL))
8282
old = __opcode_to_mem_thumb32(old);
83-
new = __opcode_to_mem_thumb32(new);
84-
} else {
83+
else
8584
old = __opcode_to_mem_arm(old);
86-
new = __opcode_to_mem_arm(new);
87-
}
8885

8986
if (validate) {
9087
if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE))

0 commit comments

Comments
 (0)