summaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/kprobes.c
diff options
context:
space:
mode:
authorPrasanna S Panchamukhi2005-05-06 01:15:40 +0200
committerLinus Torvalds2005-05-06 01:36:39 +0200
commit0b9e2cac8a56e197d0a9e06268db4c8652d23dd5 (patch)
tree6bab2badad512d39c2b606e8c2c12d271c1bee35 /arch/i386/kernel/kprobes.c
parent[PATCH] uml: header and code cleanup (diff)
downloadkernel-qcow2-linux-0b9e2cac8a56e197d0a9e06268db4c8652d23dd5.tar.gz
kernel-qcow2-linux-0b9e2cac8a56e197d0a9e06268db4c8652d23dd5.tar.xz
kernel-qcow2-linux-0b9e2cac8a56e197d0a9e06268db4c8652d23dd5.zip
[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: Prasanna S Panchamukhi <prasanna@in.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/kprobes.c')
-rw-r--r--arch/i386/kernel/kprobes.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index 671681659243..59ff9b455069 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -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;