Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751648AbdISKBg (ORCPT ); Tue, 19 Sep 2017 06:01:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:52610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751098AbdISKBf (ORCPT ); Tue, 19 Sep 2017 06:01:35 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 73C8321D29 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org From: Masami Hiramatsu To: Ingo Molnar , mingo@redhat.com Cc: x86@kernel.org, Steven Rostedt , Masami Hiramatsu , linux-kernel@vger.kernel.org, Peter Zijlstra , Ananth N Mavinakayanahalli , Thomas Gleixner , "H . Peter Anvin" , "Paul E . McKenney" , Alexei Starovoitov , Alexei Starovoitov Subject: [PATCH -tip v3 4/7] kprobes/x86: Disable preempt in optprobe Date: Tue, 19 Sep 2017 19:00:59 +0900 Message-Id: <150581525942.32348.6359217983269060829.stgit@devbox> X-Mailer: git-send-email 2.13.5 In-Reply-To: <150581509713.32348.1905525476438163954.stgit@devbox> References: <150581509713.32348.1905525476438163954.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 958 Lines: 30 Disable preempt in optprobe handler as described in Documentation/kprobes.txt, there is "Probe handlers are run with preemption disabled." Signed-off-by: Masami Hiramatsu --- arch/x86/kernel/kprobes/opt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c index 259b7e828b02..36e4f61c3eec 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);