diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2017-09-19 12:00:59 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-09-28 09:23:04 +0200 |
commit | 9a09f261a4fa52de916b0db34a36956c95f78fdc (patch) | |
tree | ff13a73c0b4baf731d9b97c71ef7e50ce1dbacd6 /arch/x86/kernel/kprobes/opt.c | |
parent | kprobes: Warn if optprobe handler tries to change execution path (diff) | |
download | linux-9a09f261a4fa52de916b0db34a36956c95f78fdc.tar.xz linux-9a09f261a4fa52de916b0db34a36956c95f78fdc.zip |
kprobes/x86: Disable preemption in optprobe
Disable preemption in optprobe handler as described
in Documentation/kprobes.txt, which says:
"Probe handlers are run with preemption disabled."
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/150581525942.32348.6359217983269060829.stgit@devbox
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | arch/x86/kernel/kprobes/opt.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c index f55810305f9a..32c35cb3550c 100644 --- a/arch/x86/kernel/kprobes/opt.c +++ b/arch/x86/kernel/kprobes/opt.c @@ -161,6 +161,7 @@ optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs) return; local_irq_save(flags); + preempt_disable(); if (kprobe_running()) { kprobes_inc_nmissed_count(&op->kp); } else { @@ -180,6 +181,7 @@ optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs) opt_pre_handler(&op->kp, regs); __this_cpu_write(current_kprobe, NULL); } + preempt_enable_no_resched(); local_irq_restore(flags); } NOKPROBE_SYMBOL(optimized_callback); |