public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <hiramatu@sdl.hitachi.co.jp>
To: Andrew Morton <akpm@osdl.org>,
		Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
		"Keshavamurthy, Anil S" <anil.s.keshavamurthy@intel.com>,
		Prasanna S Panchamukhi <prasanna@in.ibm.com>
Cc: SystemTAP <systemtap@sources.redhat.com>,
		linux-kernel <linux-kernel@vger.kernel.org>,
		Jim Keniston <jkenisto@us.ibm.com>,
		Yumiko Sugita <sugita@sdl.hitachi.co.jp>,
		Satoshi Oshima <soshima@redhat.com>,
	Hideo Aoki <haoki@redhat.com>
Subject: [PATCH] kprobe: fix resume execution on i386
Date: Wed, 26 Apr 2006 07:51:00 -0000	[thread overview]
Message-ID: <444F262D.3020402@sdl.hitachi.co.jp> (raw)

Hi, Andrew

Here is a patch to fix resume_execution() to handle
iret and absolute jump opcode correctly on i386.
This patch can be applied against 2.6.17-rc2.

Best regards,
-- 
Masami HIRAMATSU
2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory
E-mail: hiramatu@sdl.hitachi.co.jp

Signed-off-by: Masami Hiramatsu <hiramatu@sdl.hitachi.co.jp>
 kprobes.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
diff -Narup a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
--- a/arch/i386/kernel/kprobes.c	2006-04-21 12:23:45.000000000 +0900
+++ b/arch/i386/kernel/kprobes.c	2006-04-21 21:26:51.000000000 +0900
@@ -452,10 +452,11 @@ static void __kprobes resume_execution(s
 		*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;
@@ -463,10 +464,13 @@ static void __kprobes resume_execution(s
 	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
 			 */



             reply	other threads:[~2006-04-26  7:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-26  7:51 Masami Hiramatsu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-04-12 10:10 Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=444F262D.3020402@sdl.hitachi.co.jp \
    --to=hiramatu@sdl.hitachi.co.jp \
    --cc=akpm@osdl.org \
    --cc=ananth@in.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=haoki@redhat.com \
    --cc=jkenisto@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prasanna@in.ibm.com \
    --cc=soshima@redhat.com \
    --cc=sugita@sdl.hitachi.co.jp \
    --cc=systemtap@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).