[PATCH] kprobe: fix resume execution on i386
authorMasami Hiramatsu <hiramatu@sdl.hitachi.co.jp>
Fri, 28 Apr 2006 01:39:55 +0000 (18:39 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 28 Apr 2006 15:33:47 +0000 (08:33 -0700)
Fix resume_execution() to handle iret and absolute jump opcode correctly on
i386.

Signed-off-by: Masami Hiramatsu <hiramatu@sdl.hitachi.co.jp>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: "Keshavamurthy, Anil S" <anil.s.keshavamurthy@intel.com>
Cc: Prasanna S Panchamukhi <prasanna@in.ibm.com>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Yumiko Sugita <sugita@sdl.hitachi.co.jp>
Cc: Satoshi Oshima <soshima@redhat.com>
Cc: Hideo Aoki <haoki@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/kernel/kprobes.c

index 6c93ddf09512f1f1df1d6b26115b097adf05bb32..38806f427849f7f4dc8c76891229f952791064c3 100644 (file)
@@ -443,10 +443,11 @@ static void __kprobes resume_execution(struct kprobe *p,
                *tos &= ~(TF_MASK | IF_MASK);
                *tos |= kcb->kprobe_old_eflags;
                break;
-       case 0xc3:              /* ret/lret */
-       case 0xcb:
-       case 0xc2:
+       case 0xc2:              /* iret/ret/lret */
+       case 0xc3:
        case 0xca:
+       case 0xcb:
+       case 0xcf:
        case 0xea:              /* jmp absolute -- eip is correct */
                /* eip is already adjusted, no more changes required */
                p->ainsn.boostable = 1;
@@ -454,10 +455,13 @@ static void __kprobes resume_execution(struct kprobe *p,
        case 0xe8:              /* call relative - Fix return addr */
                *tos = orig_eip + (*tos - copy_eip);
                break;
+       case 0x9a:              /* call absolute -- same as call absolute, indirect */
+               *tos = orig_eip + (*tos - copy_eip);
+               goto no_change;
        case 0xff:
                if ((p->ainsn.insn[1] & 0x30) == 0x10) {
-                       /* call absolute, indirect */
                        /*
+                        * call absolute, indirect
                         * Fix return addr; eip is correct.
                         * But this is not boostable
                         */