]> git.baikalelectronics.ru Git - kernel.git/commit
arm64/ftrace: fix inadvertent BUG() in trampoline check
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Sun, 7 Apr 2019 19:06:16 +0000 (21:06 +0200)
committerWill Deacon <will.deacon@arm.com>
Mon, 8 Apr 2019 15:58:13 +0000 (16:58 +0100)
commit637fbe4872c533720f2923ae4156eb49c7988191
tree43d55b1ab816545f622a3c6330fad1898b78426c
parent71ed5bcfd45ab35e5abdfc66d15f941b2df98047
arm64/ftrace: fix inadvertent BUG() in trampoline check

The ftrace trampoline code (which deals with modules loaded out of
BL range of the core kernel) uses plt_entries_equal() to check whether
the per-module trampoline equals a zero buffer, to decide whether the
trampoline has already been initialized.

This triggers a BUG() in the opcode manipulation code, since we end
up checking the ADRP offset of a 0x0 opcode, which is not an ADRP
instruction.

So instead, add a helper to check whether a PLT is initialized, and
call that from the frace code.

Cc: <stable@vger.kernel.org> # v5.0
Fixes: 4e8dd570b3fb ("arm64/module: switch to ADRP/ADD sequences for PLT entries")
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/module.h
arch/arm64/kernel/ftrace.c