Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1580392 > unrolled thread

[PATCH 3/3] powerpc: kprobes: emulate instructions on kprobe handler re-entry

Started by"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
First post2017-02-14 09:40 +0100
Last post2017-02-14 09:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/3] powerpc: kprobes: emulate instructions on kprobe handler re-entry "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-02-14 09:40 +0100
    Re: [PATCH 3/3] powerpc: kprobes: emulate instructions on kprobe  handler re-entry Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> - 2017-02-14 09:50 +0100

#1580392 — [PATCH 3/3] powerpc: kprobes: emulate instructions on kprobe handler re-entry

From"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date2017-02-14 09:40 +0100
Subject[PATCH 3/3] powerpc: kprobes: emulate instructions on kprobe handler re-entry
Message-ID<taGOu-7QG-17@gated-at.bofh.it>
On kprobe handler re-entry, try to emulate the instruction rather than
single stepping always.

As a related change, remove the duplicate saving of msr as that is
already done in set_current_kprobe()

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/kprobes.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 9cdf2de31e9e..c213637b9d25 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -206,10 +206,17 @@ int __kprobes kprobe_handler(struct pt_regs *regs)
 			 */
 			save_previous_kprobe(kcb);
 			set_current_kprobe(p, regs, kcb);
-			kcb->kprobe_saved_msr = regs->msr;
 			kprobes_inc_nmissed_count(p);
 			prepare_singlestep(p, regs);
 			kcb->kprobe_status = KPROBE_REENTER;
+			if (p->ainsn.boostable >= 0) {
+				ret = try_to_emulate(p, regs);
+
+				if (ret > 0) {
+					restore_previous_kprobe(kcb);
+					return 1;
+				}
+			}
 			return 1;
 		} else {
 			if (*addr != BREAKPOINT_INSTRUCTION) {
-- 
2.11.0

[toc] | [next] | [standalone]


#1580398 — Re: [PATCH 3/3] powerpc: kprobes: emulate instructions on kprobe handler re-entry

FromAnanth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Date2017-02-14 09:50 +0100
SubjectRe: [PATCH 3/3] powerpc: kprobes: emulate instructions on kprobe handler re-entry
Message-ID<taGYa-7UK-9@gated-at.bofh.it>
In reply to#1580392
On Tue, Feb 14, 2017 at 02:08:03PM +0530, Naveen N. Rao wrote:
> On kprobe handler re-entry, try to emulate the instruction rather than
> single stepping always.
> 
> As a related change, remove the duplicate saving of msr as that is
> already done in set_current_kprobe()
> 
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

Acked-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web