linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS Kprobes: Support branch instructions probing

To: Maneesh Soni <manesoni@cisco.com>
Subject: Re: [PATCH] MIPS Kprobes: Support branch instructions probing
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Date: Thu, 13 Oct 2011 15:11:38 +0530
Cc: ralf@linux-mips.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, david.daney@cavium.com, kamensky@cisco.com
In-reply-to: <20111013090749.GB16761@cisco.com>
References: <20111013090749.GB16761@cisco.com>
Reply-to: ananth@in.ibm.com
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.17 (2007-11-01)
On Thu, Oct 13, 2011 at 02:37:49PM +0530, Maneesh Soni wrote:

...

I know nothing of MIPS internals, but...
 
>  static int __kprobes kprobe_handler(struct pt_regs *regs)
> @@ -239,8 +531,13 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
>                       save_previous_kprobe(kcb);
>                       set_current_kprobe(p, regs, kcb);
>                       kprobes_inc_nmissed_count(p);
> -                     prepare_singlestep(p, regs);
> +                     prepare_singlestep(p, regs, kcb);
>                       kcb->kprobe_status = KPROBE_REENTER;
> +                     if (kcb->flags & SKIP_DELAYSLOT) {
> +                             resume_execution(p, regs, kcb);
> +                             restore_previous_kprobe(kcb);
> +                             preempt_enable_no_resched();
> +                     }
>                       return 1;
>               } else {
>                       if (addr->word != breakpoint_insn.word) {
> @@ -284,8 +581,15 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
>       }
> 
>  ss_probe:
> -     prepare_singlestep(p, regs);
> -     kcb->kprobe_status = KPROBE_HIT_SS;
> +     prepare_singlestep(p, regs, kcb);
> +     if (kcb->flags & SKIP_DELAYSLOT) {
> +             kcb->kprobe_status = KPROBE_HIT_SSDONE;
> +             if (p->post_handler)
> +                     p->post_handler(p, regs, 0);
> +             resume_execution(p, regs, kcb);

You are missing a preempt_disable_no_resched() here.

Ananth

<Prev in Thread] Current Thread [Next in Thread>