linux-brain/arch/arm/probes/kprobes
Jon Medhurst c9bbd2727d arm: kprobes: Align stack to 8-bytes in test code
[ Upstream commit 974310d047 ]

kprobes test cases need to have a stack that is aligned to an 8-byte
boundary because they call other functions (and the ARM ABI mandates
that alignment) and because test cases include 64-bit accesses to the
stack. Unfortunately, GCC doesn't ensure this alignment for inline
assembler and for the code in question seems to always misalign it by
pushing just the LR register onto the stack. We therefore need to
explicitly perform stack alignment at the start of each test case.

Without this fix, some test cases will generate alignment faults on
systems where alignment is enforced. Even if the kernel is configured to
handle these faults in software, triggering them is ugly. It also
exposes limitations in the fault handling code which doesn't cope with
writes to the stack. E.g. when handling this instruction

   strd r6, [sp, #-64]!

the fault handling code will write to a stack location below the SP
value at the point the fault occurred, which coincides with where the
exception handler has pushed the saved register context. This results in
corruption of those registers.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-25 14:23:37 +01:00
..
Makefile ARM: kprobes: enable OPTPROBES for ARM 32 2015-01-13 16:10:17 +00:00
actions-arm.c ARM: kprobes: check register usage for probed instruction. 2015-01-13 16:10:48 +00:00
actions-common.c ARM: probes: move all probe code to dedicate directory 2015-01-09 09:36:50 +00:00
actions-thumb.c ARM: kprobes: collects stack consumption for store instructions 2015-01-13 16:10:06 +00:00
checkers-arm.c ARM: kprobes: check register usage for probed instruction. 2015-01-13 16:10:48 +00:00
checkers-common.c ARM: kprobes: collects stack consumption for store instructions 2015-01-13 16:10:06 +00:00
checkers-thumb.c ARM: kprobes: collects stack consumption for store instructions 2015-01-13 16:10:06 +00:00
checkers.h ARM: kprobes: check register usage for probed instruction. 2015-01-13 16:10:48 +00:00
core.c arm: kprobes: Fix the return address of multiple kretprobes 2017-12-25 14:23:37 +01:00
core.h ARM: kprobes: Fix compilation error caused by superfluous '*' 2015-02-10 15:05:30 +08:00
opt-arm.c ARM: optprobes: execute instruction during restoring if possible. 2015-01-14 12:24:52 +00:00
test-arm.c ARM: kprobes: Eliminate test code's use of BX instruction on ARMv4 CPUs 2015-01-20 09:06:04 +00:00
test-core.c arm: kprobes: Align stack to 8-bytes in test code 2017-12-25 14:23:37 +01:00
test-core.h ARM: kprobes: Fix unreliable MRS instruction tests 2015-01-13 16:10:17 +00:00
test-thumb.c ARM: kprobes: Fix unreliable MRS instruction tests 2015-01-13 16:10:17 +00:00