public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Keshavamurthy Anil S <anil.s.keshavamurthy@intel.com>
To: akpm@osdl.org
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	linux-ia64@vger.kernel.org, anil.s.keshavamurthy@intel.com,
	Rusty Lynch <rusty.lynch@intel.com>,
	systemtap@sources.redhat.com
Subject: Kprobes IA64 check jprobe break before handling
Date: Thu, 26 May 2005 21:25:39 +0000	[thread overview]
Message-ID: <20050526142539.A24770@unix-os.sc.intel.com> (raw)

From: anil.s.keshavamurthy@intel.com
Subject: Kprobes IA64 check jprobe break before handling

Once the jprobe instrumented function returns, it executes
a jprobe_break which is a break instruction with
__IA64_JPROBE_BREAK value. The current patch checks for
this break value, before assuming that jprobe 
instrumented function just completed.

The previous code was not checking for this value and
that was a bug.


Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
=================================

 arch/ia64/kernel/kprobes.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

Index: linux-2.6.12-rc5/arch/ia64/kernel/kprobes.c
=================================--- linux-2.6.12-rc5.orig/arch/ia64/kernel/kprobes.c
+++ linux-2.6.12-rc5/arch/ia64/kernel/kprobes.c
@@ -284,10 +284,11 @@ static void prepare_ss(struct kprobe *p,
 	ia64_psr(regs)->ss = 1;
 }
 
-static int pre_kprobes_handler(struct pt_regs *regs)
+static int pre_kprobes_handler(struct die_args *args)
 {
 	struct kprobe *p;
 	int ret = 0;
+	struct pt_regs *regs = args->regs;
 	kprobe_opcode_t *addr = (kprobe_opcode_t *)instruction_pointer(regs);
 
 	preempt_disable();
@@ -302,7 +303,7 @@ static int pre_kprobes_handler(struct pt
 			}
 			arch_disarm_kprobe(p);
 			ret = 1;
-		} else {
+		} else if (args->err = __IA64_BREAK_JPROBE) {
 			/*
 			 * jprobe instrumented function just completed
 			 */
@@ -310,6 +311,9 @@ static int pre_kprobes_handler(struct pt
 			if (p->break_handler && p->break_handler(p, regs)) {
 				goto ss_probe;
 			}
+		} else {
+			/* Not our break */
+			goto no_kprobe;
 		}
 	}
 
@@ -380,7 +384,7 @@ int kprobe_exceptions_notify(struct noti
 	struct die_args *args = (struct die_args *)data;
 	switch(val) {
 	case DIE_BREAK:
-		if (pre_kprobes_handler(args->regs))
+		if (pre_kprobes_handler(args))
 			return NOTIFY_STOP;
 		break;
 	case DIE_SS:

                 reply	other threads:[~2005-05-26 21:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20050526142539.A24770@unix-os.sc.intel.com \
    --to=anil.s.keshavamurthy@intel.com \
    --cc=akpm@osdl.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty.lynch@intel.com \
    --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