ARM: kprobes: Add alu_write_pc()
authorJon Medhurst <tixy@yxit.co.uk>
Fri, 1 Jul 2011 16:32:06 +0000 (17:32 +0100)
committerTixy <tixy@medhuaa1.miniserver.com>
Wed, 13 Jul 2011 17:32:48 +0000 (17:32 +0000)
commitdf4fa1f8dde23db25f50e49535d2c7db0005f9ad
treeafd56bec1275665bcd429e0dbe91352596436152
parent9a5c1284a3ec76c15a8bc51b2badc29e42fc5d92
ARM: kprobes: Add alu_write_pc()

This writes a new value to PC which was obtained as the result of an ARM
ALU instruction. For ARMv7 and later this performs interworking.

On ARM kernels we shouldn't encounter any ALU instructions trying to
switch to Thumb mode so support for this isn't strictly necessary.
However, the approach taken in all other instruction decoding is for us
to avoid unpredictable modification of the PC for security reasons. This
is usually achieved by rejecting insertion of probes on problematic
instruction, but for ALU instructions we can't do this as it depends on
the contents of the CPU registers at the time the probe is hit. So, as
we require some form of run-time checking to trap undesirable PC
modification, we may as well simulate the instructions correctly, i.e.
in the way they would behave in the absence of a probe.

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
arch/arm/kernel/kprobes-common.c
arch/arm/kernel/kprobes.h