提交 0b9e2cac 编写于 作者: P Prasanna S Panchamukhi 提交者: Linus Torvalds

[PATCH] Kprobes: Incorrect handling of probes on ret/lret instruction

Kprobes could not handle the insertion of a probe on the ret/lret
instruction and used to oops after single stepping since kprobes was
modifying eip/rip incorrectly.  Adjustment of eip/rip is not required after
single stepping in case of ret/lret instruction, because eip/rip points to
the correct location after execution of the ret/lret instruction.  This
patch fixes the above problem.
Signed-off-by: NPrasanna S Panchamukhi <prasanna@in.ibm.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 3a0a64e6
......@@ -217,6 +217,13 @@ static void resume_execution(struct kprobe *p, struct pt_regs *regs)
*tos &= ~(TF_MASK | IF_MASK);
*tos |= kprobe_old_eflags;
break;
case 0xc3: /* ret/lret */
case 0xcb:
case 0xc2:
case 0xca:
regs->eflags &= ~TF_MASK;
/* eip is already adjusted, no more changes required*/
return;
case 0xe8: /* call relative - Fix return addr */
*tos = orig_eip + (*tos - copy_eip);
break;
......
......@@ -355,6 +355,13 @@ static void resume_execution(struct kprobe *p, struct pt_regs *regs)
*tos &= ~(TF_MASK | IF_MASK);
*tos |= kprobe_old_rflags;
break;
case 0xc3: /* ret/lret */
case 0xcb:
case 0xc2:
case 0xca:
regs->eflags &= ~TF_MASK;
/* rip is already adjusted, no more changes required*/
return;
case 0xe8: /* call relative - Fix return addr */
*tos = orig_rip + (*tos - copy_rip);
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册