[PATCH] kprobe: fix resume execution on i386

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>
This commit is contained in:
Masami Hiramatsu 2006-04-27 18:39:55 -07:00 коммит произвёл Linus Torvalds
Родитель bf661987da
Коммит bcff5cd667
1 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

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