提交 89cb14c0 编写于 作者: K Keshavamurthy Anil S 提交者: Linus Torvalds

[PATCH] Kprobes/IA64: check jprobe break before handling

Once the jprobe instrumented function returns, it executes a jprobe_break
which is a break instruction with __IA64_JPROBE_BREAK value.  The current
patch checks for this break value, before assuming that jprobe instrumented
function just completed.

The previous code was not checking for this value and that was a bug.
Signed-off-by: NAnil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 708de8f1
...@@ -419,10 +419,11 @@ static void prepare_ss(struct kprobe *p, struct pt_regs *regs) ...@@ -419,10 +419,11 @@ static void prepare_ss(struct kprobe *p, struct pt_regs *regs)
ia64_psr(regs)->ss = 1; ia64_psr(regs)->ss = 1;
} }
static int pre_kprobes_handler(struct pt_regs *regs) static int pre_kprobes_handler(struct die_args *args)
{ {
struct kprobe *p; struct kprobe *p;
int ret = 0; int ret = 0;
struct pt_regs *regs = args->regs;
kprobe_opcode_t *addr = (kprobe_opcode_t *)instruction_pointer(regs); kprobe_opcode_t *addr = (kprobe_opcode_t *)instruction_pointer(regs);
preempt_disable(); preempt_disable();
...@@ -437,7 +438,7 @@ static int pre_kprobes_handler(struct pt_regs *regs) ...@@ -437,7 +438,7 @@ static int pre_kprobes_handler(struct pt_regs *regs)
} }
arch_disarm_kprobe(p); arch_disarm_kprobe(p);
ret = 1; ret = 1;
} else { } else if (args->err == __IA64_BREAK_JPROBE) {
/* /*
* jprobe instrumented function just completed * jprobe instrumented function just completed
*/ */
...@@ -445,6 +446,9 @@ static int pre_kprobes_handler(struct pt_regs *regs) ...@@ -445,6 +446,9 @@ static int pre_kprobes_handler(struct pt_regs *regs)
if (p->break_handler && p->break_handler(p, regs)) { if (p->break_handler && p->break_handler(p, regs)) {
goto ss_probe; goto ss_probe;
} }
} else {
/* Not our break */
goto no_kprobe;
} }
} }
...@@ -515,7 +519,7 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, ...@@ -515,7 +519,7 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val,
struct die_args *args = (struct die_args *)data; struct die_args *args = (struct die_args *)data;
switch(val) { switch(val) {
case DIE_BREAK: case DIE_BREAK:
if (pre_kprobes_handler(args->regs)) if (pre_kprobes_handler(args))
return NOTIFY_STOP; return NOTIFY_STOP;
break; break;
case DIE_SS: case DIE_SS:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册