ARM: kprobes: treat R7 as the frame pointer register in Thumb2 builds
authorArd Biesheuvel <ardb@kernel.org>
Wed, 26 Jan 2022 10:27:21 +0000 (11:27 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Wed, 9 Feb 2022 08:13:59 +0000 (09:13 +0100)
commitdd12e97f3c7233a65a0125e5c5c793da16e1137d
treea90690633c18bbdb0ed3dffe6bbeef8d83cbba9e
parent41918ec82eb6f80c8b401422f27ca76c85aa0cb7
ARM: kprobes: treat R7 as the frame pointer register in Thumb2 builds

Thumb2 code uses R7 as the frame pointer rather than R11, because the
opcodes to access it are generally shorter.

This means that there are cases where we cannot simply add it to the
clobber list of an asm() block, but need to preserve/restore it
explicitly, or the compiler may complain in some cases (e.g., Clang
builds with ftrace enabled).

Since R11 is not special in that case, clobber it instead, and use it to
preserve/restore the value of R7.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
arch/arm/probes/kprobes/actions-common.c
arch/arm/probes/kprobes/actions-thumb.c