“f822566165dd46ff5de9bf895cfa6c51f53bb0c4”上不存在“arch/m32r/include/asm/mman.h”
提交 9233c1ee 编写于 作者: M Maneesh Soni 提交者: Ralf Baechle

MIPS Kprobes: Deny probes on ll/sc instructions

As ll/sc instruction are for atomic read-modify-write operations, allowing
probes on top of these insturctions is a bad idea.
Signed-off-by: NVictor Kamensky <kamensky@cisco.com>
Signed-off-by: NManeesh Soni <manesoni@cisco.com>
Cc: David Daney <david.daney@cavium.com>
Cc: ananth@in.ibm.com
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2912/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
上级 41dde781
......@@ -113,6 +113,30 @@ static int __kprobes insn_has_delayslot(union mips_instruction insn)
return 0;
}
/*
* insn_has_ll_or_sc function checks whether instruction is ll or sc
* one; putting breakpoint on top of atomic ll/sc pair is bad idea;
* so we need to prevent it and refuse kprobes insertion for such
* instructions; cannot do much about breakpoint in the middle of
* ll/sc pair; it is upto user to avoid those places
*/
static int __kprobes insn_has_ll_or_sc(union mips_instruction insn)
{
int ret = 0;
switch (insn.i_format.opcode) {
case ll_op:
case lld_op:
case sc_op:
case scd_op:
ret = 1;
break;
default:
break;
}
return ret;
}
int __kprobes arch_prepare_kprobe(struct kprobe *p)
{
union mips_instruction insn;
......@@ -121,6 +145,13 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
insn = p->addr[0];
if (insn_has_ll_or_sc(insn)) {
pr_notice("Kprobes for ll and sc instructions are not"
"supported\n");
ret = -EINVAL;
goto out;
}
if (insn_has_delayslot(insn)) {
pr_notice("Kprobes for branch and jump instructions are not"
"supported\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册