[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a0MJGpg6AkmwRL6o7TCPOQXSMDShutigvBjeOMDn0BHaA@mail.gmail.com>
Date: Wed, 8 Jan 2020 13:22:52 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Will Deacon <will@...nel.org>,
"the arch/x86 maintainers" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>, bristot@...hat.com,
Jason Baron <jbaron@...mai.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>, namit@...are.com,
"H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Jessica Yu <jeyu@...nel.org>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
Mark Rutland <mark.rutland@....com>,
James Morse <james.morse@....com>,
Russell King <rmk+kernel@...linux.org.uk>,
Rabin Vincent <rabin@....in>, Nicolas Pitre <nico@...xnic.net>
Subject: Re: [PATCH -v5mkII 13/17] arm/ftrace: Use __patch_text()
On Wed, Nov 13, 2019 at 10:29 AM Peter Zijlstra <peterz@...radead.org> wrote:
> @@ -49,8 +49,8 @@ obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o
> obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o
> obj-$(CONFIG_ARM_ARCH_TIMER) += arch_timer.o
> obj-$(CONFIG_FUNCTION_TRACER) += entry-ftrace.o
> -obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o insn.o
> -obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o insn.o
> +obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o insn.o patch.o
> +obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o insn.o patch.o
> obj-$(CONFIG_JUMP_LABEL) += jump_label.o insn.o patch.o
> obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
This broke randconfig builds with big-endian ARMv5:
../arch/arm/kernel/patch.c: In function '__patch_text_real':
../arch/arm/kernel/patch.c:94:11: error: implicit declaration of
function '__opcode_to_mem_thumb32'
[-Werror=implicit-function-declaration]
insn = __opcode_to_mem_thumb32(insn);
^~~~~~~~~~~~~~~~~~~~~~~
The problem is that we don't have a BE32 definition of
__opcode_to_mem_thumb32, mostly because no hardware
supports that.
One possible workaround is a big ugly:
diff --git a/arch/arm/kernel/patch.c b/arch/arm/kernel/patch.c
index d0a05a3bdb96..1067fd122897 100644
--- a/arch/arm/kernel/patch.c
+++ b/arch/arm/kernel/patch.c
@@ -90,9 +90,11 @@ void __kprobes __patch_text_real(void *addr,
unsigned int insn, bool remap)
size = sizeof(u32);
} else {
+#ifdef CONFIG_THUMB2_KERNEL
if (thumb2)
insn = __opcode_to_mem_thumb32(insn);
else
+#endif
insn = __opcode_to_mem_arm(insn);
*(u32 *)waddr = insn;
Any other suggestions?
Arnd
Powered by blists - more mailing lists