Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Peter Zijlstra and committed by
Ingo Molnar
be993e44 0a679e13

+2 -5
+2 -5
arch/arm/kernel/ftrace.c
··· 78 78 { 79 79 unsigned long replaced; 80 80 81 - if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) { 81 + if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) 82 82 old = __opcode_to_mem_thumb32(old); 83 - new = __opcode_to_mem_thumb32(new); 84 - } else { 83 + else 85 84 old = __opcode_to_mem_arm(old); 86 - new = __opcode_to_mem_arm(new); 87 - } 88 85 89 86 if (validate) { 90 87 if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE))