summaryrefslogtreecommitdiff
path: root/arch/arm/probes/kprobes/core.c
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2015-01-05 19:29:25 +0800
committerJon Medhurst <tixy@linaro.org>2015-01-13 16:10:15 +0000
commita0266c214fab21371a499e6ab1c9385cc6589189 (patch)
tree69accee3d0fdc9ae9a0c3c683a7ed87497e61a81 /arch/arm/probes/kprobes/core.c
parent6624cf651f1a14363d0385f36dc255d304ac7ebb (diff)
ARM: kprobes: disallow probing stack consuming instructions
This patch prohibits probing instructions for which the stack requirements are unable to be determined statically. Some test cases are found not work again after the modification, this patch also removes them. Signed-off-by: Wang Nan <wangnan0@huawei.com> Reviewed-by: Jon Medhurst <tixy@linaro.org> Signed-off-by: Jon Medhurst <tixy@linaro.org>
Diffstat (limited to 'arch/arm/probes/kprobes/core.c')
-rw-r--r--arch/arm/probes/kprobes/core.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/probes/kprobes/core.c b/arch/arm/probes/kprobes/core.c
index 74f3dc3ac212..3a58db4cc1c6 100644
--- a/arch/arm/probes/kprobes/core.c
+++ b/arch/arm/probes/kprobes/core.c
@@ -115,6 +115,15 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
break;
}
+ /*
+ * Never instrument insn like 'str r0, [sp, +/-r1]'. Also, insn likes
+ * 'str r0, [sp, #-68]' should also be prohibited.
+ * See __und_svc.
+ */
+ if ((p->ainsn.stack_space < 0) ||
+ (p->ainsn.stack_space > MAX_STACK_SIZE))
+ return -EINVAL;
+
return 0;
}