diff options
author | Jon Medhurst (Tixy) <tixy@linaro.org> | 2015-01-05 19:29:29 +0800 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2015-01-13 16:10:16 +0000 |
commit | 8d257e95a9e643518e72232bf852b054a3d06c95 (patch) | |
tree | bd73938c1d1980917b7eaa1d8f77ec8bb06d8f5d /arch/arm/probes/kprobes/test-core.c | |
parent | ARM: kprobes: disallow probing stack consuming instructions (diff) | |
download | linux-dev-8d257e95a9e643518e72232bf852b054a3d06c95.tar.xz linux-dev-8d257e95a9e643518e72232bf852b054a3d06c95.zip |
ARM: kprobes: Add test cases for stack consuming instructions
These have extra 'checker' functions associated with them so lets make
sure those get covered by testing. As they may create uninitialised
space on the stack we also update the test code to ensure such space is
consistent between test runs. This is done by disabling interrupts in
setup_test_context().
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Diffstat (limited to 'arch/arm/probes/kprobes/test-core.c')
-rw-r--r-- | arch/arm/probes/kprobes/test-core.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/probes/kprobes/test-core.c b/arch/arm/probes/kprobes/test-core.c index 7ab633d51954..7c5ddd5a6afd 100644 --- a/arch/arm/probes/kprobes/test-core.c +++ b/arch/arm/probes/kprobes/test-core.c @@ -1196,6 +1196,13 @@ static void setup_test_context(struct pt_regs *regs) regs->uregs[arg->reg] = (unsigned long)current_stack + arg->val; memory_needs_checking = true; + /* + * Test memory at an address below SP is in danger of + * being altered by an interrupt occurring and pushing + * data onto the stack. Disable interrupts to stop this. + */ + if (arg->reg == 13) + regs->ARM_cpsr |= PSR_I_BIT; break; } case ARG_TYPE_MEM: { @@ -1272,6 +1279,8 @@ test_after_pre_handler(struct kprobe *p, struct pt_regs *regs) /* Undo any changes done to SP by the test case */ regs->ARM_sp = (unsigned long)current_stack; + /* Enable interrupts in case setup_test_context disabled them */ + regs->ARM_cpsr &= ~PSR_I_BIT; container_of(p, struct test_probe, kprobe)->hit = test_instance; return 0; |