ARM: ftrace: avoid redundant loads or clobbering IP
authorArd Biesheuvel <ardb@kernel.org>
Sun, 23 Jan 2022 19:18:33 +0000 (20:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:24:00 +0000 (14:24 +0200)
commit330de92eb10f77e45d8c93804c931ffe0fff4b78
treebf14caa2a3d9ead5fd0a640545ea65c62c981e54
parent3f887cb763a0443e4c1adb5fe5a6d6058f4b3d96
ARM: ftrace: avoid redundant loads or clobbering IP

[ Upstream commit d11967870815b5ab89843980e35aab616c97c463 ]

Tweak the ftrace return paths to avoid redundant loads of SP, as well as
unnecessary clobbering of IP.

This also fixes the inconsistency of using MOV to perform a function
return, which is sub-optimal on recent micro-architectures but more
importantly, does not perform an interworking return, unlike compiler
generated function returns in Thumb2 builds.

Let's fix this by popping PC from the stack like most ordinary code
does.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm/kernel/entry-ftrace.S