diff options
author | Prasanna S Panchamukhi <prasanna@in.ibm.com> | 2005-05-05 19:15:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-05 19:36:39 -0400 |
commit | 0b9e2cac8a56e197d0a9e06268db4c8652d23dd5 (patch) | |
tree | 6bab2badad512d39c2b606e8c2c12d271c1bee35 /arch/x86_64/kernel | |
parent | 3a0a64e6c917b2ccc311cf978cc9d7eef7b31c47 (diff) |
[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/x86_64/kernel')
-rw-r--r-- | arch/x86_64/kernel/kprobes.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c index 4f2a852299b6..f77f8a0ff187 100644 --- a/arch/x86_64/kernel/kprobes.c +++ b/arch/x86_64/kernel/kprobes.c | |||
@@ -355,6 +355,13 @@ static void resume_execution(struct kprobe *p, struct pt_regs *regs) | |||
355 | *tos &= ~(TF_MASK | IF_MASK); | 355 | *tos &= ~(TF_MASK | IF_MASK); |
356 | *tos |= kprobe_old_rflags; | 356 | *tos |= kprobe_old_rflags; |
357 | break; | 357 | break; |
358 | case 0xc3: /* ret/lret */ | ||
359 | case 0xcb: | ||
360 | case 0xc2: | ||
361 | case 0xca: | ||
362 | regs->eflags &= ~TF_MASK; | ||
363 | /* rip is already adjusted, no more changes required*/ | ||
364 | return; | ||
358 | case 0xe8: /* call relative - Fix return addr */ | 365 | case 0xe8: /* call relative - Fix return addr */ |
359 | *tos = orig_rip + (*tos - copy_rip); | 366 | *tos = orig_rip + (*tos - copy_rip); |
360 | break; | 367 | break; |