]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: backtrace-clang: avoid crash on bogus frame pointer
authorArd Biesheuvel <ardb@kernel.org>
Fri, 15 Oct 2021 14:27:09 +0000 (16:27 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Fri, 3 Dec 2021 14:11:31 +0000 (15:11 +0100)
commitfd72ef273296d443decb4a3539b06d8a23eb65c1
tree16e293d6b1d12f0e5253407adc48d36c93547068
parentd3dc0432cca3a46494a1c13009b6259f848a0b0e
ARM: backtrace-clang: avoid crash on bogus frame pointer

The Clang backtrace code dereferences the link register value pulled
from the stack to decide whether the caller was a branch-and-link
instruction, in order to subsequently decode the offset to find the
start of the calling function. Unlike other loads in this routine, this
one is not protected by a fixup, and may therefore cause a crash if the
address in question is bogus.

So let's fix this, by treating the fault as a failure to decode the 'bl'
instruction. To avoid a label renum, reuse a fixup label that guards an
instruction that cannot fault to begin with.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Marc Zyngier <maz@kernel.org>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com> # ARMv7M
arch/arm/lib/backtrace-clang.S