lkml.org 
[lkml]   [2015]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] early kprobes: x86: don't try to recover ftraced instruction before ftrace get ready.
Date
Before ftrace convertin instruction to nop, if an early kprobe is
registered then unregistered, without this patch its first bytes will
be replaced by head of NOP, which may confuse ftrace.

Actually, since we have a patch which convert ftrace entry to nop
when probing, this problem should never be triggered. Provide it for
safety.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
---
arch/x86/kernel/kprobes/core.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 87beb64..c7d304d 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -225,6 +225,9 @@ __recover_probed_insn(kprobe_opcode_t *buf, unsigned long addr)
struct kprobe *kp;
unsigned long faddr;

+ if (!kprobes_on_ftrace_initialized)
+ return addr;
+
kp = get_kprobe((void *)addr);
faddr = ftrace_location(addr);
/*
--
1.8.4


\
 
 \ /
  Last update: 2015-03-03 06:41    [W:0.207 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site