2c89240b630e94c1a5949860b7bfcf28130bd9c8 |
|
27-Aug-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Add exports for test code The test code will be using kprobes' internal decoding tables so we need to export these for when then the tests are compiled as a module. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
df4fa1f8dde23db25f50e49535d2c7db0005f9ad |
|
01-Jul-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
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>
|
235a4ce79feb8d5351f9164981bc57d5e29f974b |
|
07-Jul-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Add common decoding function for LDM and STM The encoding of these instructions is substantially the same for both ARM and Thumb, so we can have common decoding and simulation functions. This patch moves the simulation functions from kprobes-arm.c to kprobes-common.c. It also adds a new simulation function (simulate_ldm1_pc) for the case where we load into PC because this may need to interwork. The instruction decoding is done by a custom function (kprobe_decode_ldmstm) rather than just relying on decoding table entries because we will later be adding optimisation code. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
263e368a2f1f960db07d7524a4a3e7df951f1f72 |
|
10-Jun-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Add load_write_pc() This writes a value to PC which was obtained as the result of a LDR or LDM instruction. For ARMv5T and later this must perform interworking. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
059987ffa7f8905fada25c8af1734e254209c55d |
|
09-Jun-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Add bx_write_pc() This writes a value to PC, with interworking. I.e. switches to Thumb or ARM mode depending on the state of the least significant bit. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
3f92dfed6a9a5f490128c8e7cc6a64dfe412994f |
|
02-Jul-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Decode 16-bit Thumb hint instructions For hints which may have observable effects, like SEV (send event), we use kprobe_emulate_none which emulates the hint by executing the original instruction. For NOP we simulate the instruction using kprobe_simulate_nop, which does nothing. As probes execute with interrupts disabled this is also used for hints which may block for an indefinite time, like WFE (wait for event). Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
0d1a095aa1e6e2a233bfb1729e15233e77f69d54 |
|
26-Apr-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Infrastructure for table driven decoding of CPU instructions The existing ARM instruction decoding functions are a mass of if/else code. Rather than follow this pattern for Thumb instruction decoding this patch implements an infrastructure for a new table driven scheme. This has several advantages: - Reduces the kernel size by approx 2kB. (The ARM instruction decoding will eventually have -3.1kB code, +1.3kB data; with similar or better estimated savings for Thumb decoding.) - Allows programmatic checking of decoding consistency and test case coverage. - Provides more uniform source code and is therefore, arguably, clearer. For a detailed explanation of how decoding tables work see the in-source documentation in kprobes.h, and also for kprobe_decode_insn(). Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
3b26945597d5eff5d428a268c9d109338fce801e |
|
16-Jun-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Use conditional breakpoints for ARM probes Now we no longer trigger probes on conditional instructions when the condition is false, we can make use of conditional instructions as breakpoints in ARM code to avoid taking unnecessary exceptions. Note, we can't rely on not getting an exception when the condition check fails, as that is Implementation Defined on newer ARM architectures. We therefore still need to perform manual condition checks as well. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
6aaa8b5570c7b5b9eb8913ec80263a1012b1dd66 |
|
16-Jun-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Add it_advance() This advances the ITSTATE bits in CPSR to their values for the next instruction. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
aceb487ab2ea0dca43f5131e456f45bc9f8c1bed |
|
19-Apr-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Add Thumb breakpoint support Extend the breakpoint insertion and catching functions to support Thumb code. As breakpoints are no longer of a fixed size, the flush_insns macro is modified to take a size argument instead of an instruction count. Note, we need both 16- and 32-bit Thumb breakpoints, because if we were to use a 16-bit breakpoint to replace a 32-bit instruction which was in an IT block, and the condition check failed, then the breakpoint may not fire (it's unpredictable behaviour) and the CPU could then try and execute the second half of the 32-bit Thumb instruction. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
2437170710c4a3dee137a65623960aa7ac82a32e |
|
19-Apr-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Add Thumb instruction decoding stubs Extend arch_prepare_kprobe to support probing of Thumb code. For the actual decoding of Thumb instructions, stub functions are added which currently just reject the probe. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
aea490299f7f0412f884a4895bc96211d8d8dbaf |
|
07-Jul-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Make str_pc_offset a constant on ARMv7 The str_pc_offset value is architecturally defined on ARMv7 onwards so we can make it a compile time constant. This means on Thumb kernels the runtime checking code isn't needed, which saves us from having to fix it to work for Thumb. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
6c8df3300f60cae54aeb2a6dda8efe7ffe16a322 |
|
07-Jul-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Move find_str_pc_offset into kprobes-common.c Move str_pc_offset into kprobes-common.c as it will be needed by common code later. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
1b59d874660be7f790861ad849858cc009089515 |
|
06-Jul-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Move is_writeback define to header file. This will be used later in other files. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
0ab4c02ddae2e1d32d686a7773608f6c44fb2a83 |
|
06-Jul-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Add kprobes-common.c This file will contain the instruction decoding and emulation code which is common to both ARM and Thumb instruction sets. For now, we will just move over condition_checks from kprobes-arm.c This table is also renamed to kprobe_condition_checks to avoid polluting the public namespace with a too generic name. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|
221bf15ffd2ad6cdc624aa4274f706499501c123 |
|
20-Apr-2011 |
Jon Medhurst <tixy@yxit.co.uk> |
ARM: kprobes: Split out internal parts of kprobes.h Later, we will be adding a considerable amount of internal implementation definitions to kprobe header files and it would be good to have these in local header file along side the source code, rather than pollute the existing header which is include by all users of kprobes. To this end, we add arch/arm/kernel/kprobes.h and move into this the existing internal defintions from arch/arm/include/asm/kprobes.h Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
|