This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: kprobe fault handling


> 
>     arch/i386/kernel/kprobes.c |   32 +++++++++++++++++++++++++++++---
>     1 files changed, 29 insertions(+), 3 deletions(-)
> 
>            if (kcb->kprobe_status & KPROBE_HIT_SS) {
>    +               /*
>    +                  *  We are here because the instruction being single
>    stepped
>    +                  *  caused a page fault. We reset the current kprobe
>    and the
>    +                 * eip points back to the probe address and allow the
>    page
>    +                * fault handler.
>    +                */
>                    resume_execution(cur, regs, kcb);
resume_execution() tries to fixup the relative IP address and/or
tries to fixup branch address as if we were successfull in single stepping.
I think we just need to point eip back to probed address here.
Also as Bibo pointed out, not sure how do_page_faulut() function can fix up the 
page   we are trying to single step as the current eip in the regs points to 
probed address.

> 
>                    reset_current_kprobe();
Need to handle KPROBE_REENTER case here, i.e 
if(kcb->kprobe_status & KPROBE_REENTER) {
	restore_previous_kprobe();
} else {
	reset_current_kprobe();
}
>                    preempt_enable_no_resched();

-anil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]