Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp104420imj; Wed, 13 Feb 2019 05:28:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IY3AY3DhAayGsucawTlSepW2lgCUWVv9DHAhzuRC00TCFK32p53ME55xKJED5gdvq+oo6W9 X-Received: by 2002:a62:59d0:: with SMTP id k77mr492252pfj.211.1550064524049; Wed, 13 Feb 2019 05:28:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550064524; cv=none; d=google.com; s=arc-20160816; b=CLgXa3XupjbNqxH2gS+PgtlizL4bTA2JoHqqrjg8Ilty0i9CqPj9+LP6wU3NFA8m3v 9x+PL4cvDAZ+XGWr/CkBiUQ87jq1R+143atYnouGihy+vpJQx/h6bxjnYmMHudL264t0 3ahzXdhSXlpyEQbXn3BvORVx33NrywOjYYnb/m37f2ySPB4S9lWuPZ2wGQVJcw28b4LD DwXPGXmXhPPXhYXDKZSUGBk1EpxhY/YlSxbkT5OGfuor6NfjaguUR5DGWD7sQI2vqWJx Zvbd9gQxczkp+DpKMdzO91vwD9c+W+6S7Ly6eOIe/NrapeIA40w7ceY2c457pC5IoD57 08zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=MU36HwGR95/sw4NEcJPGbQ9EMq6VDzrG4S/doHPfJnc=; b=LGzBxM+pa4qxOAhis8pkqsKY+G8JdObEjmzmoRdeAVk92lh59q+ZtDrp/fYUW624cm PEaGPDpI240+UiYv96BcMVsJTcv/799wk8Zzww2nY/sCGp65W571krE+Q/qeCc8hI+kK SsYtfHfmO6HHGK2h+ZY2YOrxg0jVDu/MlgxANBYxDdNdOVf0DmpVH3rDp2rNwTbopIBU ORwXV4Hji69M/nJA3r5/+bziJorQA531kl9IawcvzjE5lbLJDyWU9AwpcQGVyv1Ic2Wy uknxszwExN2p/i3rT8PZrdEiAVTrynEh6YJT0scwJ2IRt/l4tbZFyzALpWqFFBC5T/EG PDEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e15si15490734pgg.281.2019.02.13.05.28.22; Wed, 13 Feb 2019 05:28:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390208AbfBMJDu (ORCPT + 99 others); Wed, 13 Feb 2019 04:03:50 -0500 Received: from terminus.zytor.com ([198.137.202.136]:43247 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727458AbfBMJDt (ORCPT ); Wed, 13 Feb 2019 04:03:49 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x1D920wE196211 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 13 Feb 2019 01:02:00 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x1D9202e196208; Wed, 13 Feb 2019 01:02:00 -0800 Date: Wed, 13 Feb 2019 01:02:00 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Masami Hiramatsu Message-ID: Cc: alexander.shishkin@linux.intel.com, peterz@infradead.org, hpa@zytor.com, tglx@linutronix.de, mingo@kernel.org, jolsa@redhat.com, torvalds@linux-foundation.org, acme@redhat.com, righi.andrea@gmail.com, rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com, linux-kernel@vger.kernel.org Reply-To: torvalds@linux-foundation.org, mingo@kernel.org, jolsa@redhat.com, peterz@infradead.org, tglx@linutronix.de, hpa@zytor.com, alexander.shishkin@linux.intel.com, mathieu.desnoyers@efficios.com, linux-kernel@vger.kernel.org, mhiramat@kernel.org, righi.andrea@gmail.com, rostedt@goodmis.org, acme@redhat.com In-Reply-To: <154998802073.31052.17255044712514564153.stgit@devbox> References: <154998802073.31052.17255044712514564153.stgit@devbox> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] kprobes: Prohibit probing on hardirq tracers Git-Commit-ID: eeeb080bae906a57b6513d37efe3c38f2cb87a1c X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,BAYES_00, FREEMAIL_FORGED_REPLYTO,T_DATE_IN_FUTURE_96_Q autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: eeeb080bae906a57b6513d37efe3c38f2cb87a1c Gitweb: https://git.kernel.org/tip/eeeb080bae906a57b6513d37efe3c38f2cb87a1c Author: Masami Hiramatsu AuthorDate: Wed, 13 Feb 2019 01:13:40 +0900 Committer: Ingo Molnar CommitDate: Wed, 13 Feb 2019 08:16:40 +0100 kprobes: Prohibit probing on hardirq tracers Since kprobes breakpoint handling involves hardirq tracer, probing these functions cause breakpoint recursion problem. Prohibit probing on those functions. Signed-off-by: Masami Hiramatsu Acked-by: Steven Rostedt (VMware) Cc: Alexander Shishkin Cc: Andrea Righi Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Mathieu Desnoyers Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/154998802073.31052.17255044712514564153.stgit@devbox Signed-off-by: Ingo Molnar --- kernel/trace/trace_irqsoff.c | 9 +++++++-- kernel/trace/trace_preemptirq.c | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index d3294721f119..d42a473b8240 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "trace.h" @@ -365,7 +366,7 @@ out: __trace_function(tr, CALLER_ADDR0, parent_ip, flags, pc); } -static inline void +static nokprobe_inline void start_critical_timing(unsigned long ip, unsigned long parent_ip, int pc) { int cpu; @@ -401,7 +402,7 @@ start_critical_timing(unsigned long ip, unsigned long parent_ip, int pc) atomic_dec(&data->disabled); } -static inline void +static nokprobe_inline void stop_critical_timing(unsigned long ip, unsigned long parent_ip, int pc) { int cpu; @@ -443,6 +444,7 @@ void start_critical_timings(void) start_critical_timing(CALLER_ADDR0, CALLER_ADDR1, pc); } EXPORT_SYMBOL_GPL(start_critical_timings); +NOKPROBE_SYMBOL(start_critical_timings); void stop_critical_timings(void) { @@ -452,6 +454,7 @@ void stop_critical_timings(void) stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1, pc); } EXPORT_SYMBOL_GPL(stop_critical_timings); +NOKPROBE_SYMBOL(stop_critical_timings); #ifdef CONFIG_FUNCTION_TRACER static bool function_enabled; @@ -611,6 +614,7 @@ void tracer_hardirqs_on(unsigned long a0, unsigned long a1) if (!preempt_trace(pc) && irq_trace()) stop_critical_timing(a0, a1, pc); } +NOKPROBE_SYMBOL(tracer_hardirqs_on); void tracer_hardirqs_off(unsigned long a0, unsigned long a1) { @@ -619,6 +623,7 @@ void tracer_hardirqs_off(unsigned long a0, unsigned long a1) if (!preempt_trace(pc) && irq_trace()) start_critical_timing(a0, a1, pc); } +NOKPROBE_SYMBOL(tracer_hardirqs_off); static int irqsoff_tracer_init(struct trace_array *tr) { diff --git a/kernel/trace/trace_preemptirq.c b/kernel/trace/trace_preemptirq.c index 71f553cceb3c..4d8e99fdbbbe 100644 --- a/kernel/trace/trace_preemptirq.c +++ b/kernel/trace/trace_preemptirq.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "trace.h" #define CREATE_TRACE_POINTS @@ -30,6 +31,7 @@ void trace_hardirqs_on(void) lockdep_hardirqs_on(CALLER_ADDR0); } EXPORT_SYMBOL(trace_hardirqs_on); +NOKPROBE_SYMBOL(trace_hardirqs_on); void trace_hardirqs_off(void) { @@ -43,6 +45,7 @@ void trace_hardirqs_off(void) lockdep_hardirqs_off(CALLER_ADDR0); } EXPORT_SYMBOL(trace_hardirqs_off); +NOKPROBE_SYMBOL(trace_hardirqs_off); __visible void trace_hardirqs_on_caller(unsigned long caller_addr) { @@ -56,6 +59,7 @@ __visible void trace_hardirqs_on_caller(unsigned long caller_addr) lockdep_hardirqs_on(CALLER_ADDR0); } EXPORT_SYMBOL(trace_hardirqs_on_caller); +NOKPROBE_SYMBOL(trace_hardirqs_on_caller); __visible void trace_hardirqs_off_caller(unsigned long caller_addr) { @@ -69,6 +73,7 @@ __visible void trace_hardirqs_off_caller(unsigned long caller_addr) lockdep_hardirqs_off(CALLER_ADDR0); } EXPORT_SYMBOL(trace_hardirqs_off_caller); +NOKPROBE_SYMBOL(trace_hardirqs_off_caller); #endif /* CONFIG_TRACE_IRQFLAGS */ #ifdef CONFIG_TRACE_PREEMPT_TOGGLE