public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "Mao, Bibo" <bibo.mao@intel.com>
To: <prasanna@in.ibm.com>
Cc: <systemtap@sources.redhat.com>
Subject: RE: [PATCH] Kprobes- robust fault handling for i386
Date: Wed, 22 Feb 2006 10:41:00 -0000	[thread overview]
Message-ID: <9FBCE015AF479F46B3B410499F3AE05BC4BF0C@pdsmsx405> (raw)

I have one question and I reply between the lines.

>-----Original Message-----
>From: systemtap-owner@sourceware.org [mailto:systemtap-owner@sourceware.org]
>On Behalf Of Prasanna S Panchamukhi
>Sent: 2006年2月22日 15:13
>To: systemtap@sources.redhat.com
>Subject: [PATCH] Kprobes- robust fault handling for i386
>
>Hi,
>
>Below is the prototype for robust fault handling, as of now
>this patch is for i386 architecture and should be easily
>ported to other architectures. Your comments and suggestions
>are welcome. This patch has been tested for page faults that
>occur while accessing user address space data. Support needs
>to be added for cases such as divide by zero, NULL pointer
>dereference, etc. Also as of now we increment the nmissed
>count, instead we can track such instances by having
>independent counters such as nprefault, npostfault.
>
>Thanks
>Prasanna

>@@ -509,9 +554,21 @@ static inline int post_kprobe_handler(st
> 	if (!cur)
> 		return 0;
>
>-	if ((kcb->kprobe_status != KPROBE_REENTER) && cur->post_handler) {
>+	if ((kcb->kprobe_status != KPROBE_REENTER)
>+			&& (kcb->kprobe_status != KPROBE_HIT_FAULT)
>+			&& cur->post_handler) {
>+		kcb->handler_regs = regs;
> 		kcb->kprobe_status = KPROBE_HIT_SSDONE;
>-		cur->post_handler(cur, regs, 0);
>+		kprobe_post_handler_trampoline(cur, regs, kcb);
>+		kcb = get_kprobe_ctlblk();
>+		/*
>+		 * Check if user defined handler caused the page fault, in
>+		 * such a case restore the register pointers, just resets
>+		 * the current kprobe and resumes the execution, since we
>+		 * have already single stepped on original instruction.
>+		 */
>+		if (kcb->kprobe_status == KPROBE_HIT_FAULT)
>+			regs = kcb->handler_regs;
> 	}
>
> 	resume_execution(cur, regs, kcb);
>@@ -541,18 +598,55 @@ static inline int kprobe_fault_handler(s
> {
> 	struct kprobe *cur = kprobe_running();
> 	struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
>+	unsigned long *sara = (unsigned long *)&regs->esp;
What is &regs->esp meaning here? If instruction which causes page fault is not first instruction of called function, then &regs->esp will be local variable's memory address in the called function, but not caller return address.
>........
>+		*sara = kcb->handler_retaddr;
So in this line maybe sometimes it will only change callee function local variant's value, but not change caller return value.

Regards
Bibo,mao

             reply	other threads:[~2006-02-22 10:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-22 10:41 Mao, Bibo [this message]
2006-02-23  8:58 ` Prasanna S Panchamukhi
2006-02-23 12:40   ` Frank Ch. Eigler
2006-02-23 13:17     ` Prasanna S Panchamukhi
  -- strict thread matches above, loose matches on Subject: below --
2006-02-24 19:17 Keshavamurthy, Anil S
2006-02-27  9:24 ` Prasanna S Panchamukhi
2006-02-28  1:02   ` Keshavamurthy Anil S
2006-02-28 14:37     ` Prasanna S Panchamukhi
2006-02-28 20:25       ` Keshavamurthy Anil S
2006-03-01 14:49         ` Prasanna S Panchamukhi
2006-02-23  0:44 Keshavamurthy, Anil S
2006-02-22  7:11 Prasanna S Panchamukhi
2006-02-24  1:33 ` Jim Keniston

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=9FBCE015AF479F46B3B410499F3AE05BC4BF0C@pdsmsx405 \
    --to=bibo.mao@intel.com \
    --cc=prasanna@in.ibm.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).