Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4005552imj; Tue, 12 Feb 2019 08:14:53 -0800 (PST) X-Google-Smtp-Source: AHgI3IZoUP8d3THXsQ71VQ2MeCyZI83rzyENWk+hYWhrdkbNtQ5oMvQiH/RReAN/reJTKME37mMT X-Received: by 2002:a17:902:2aaa:: with SMTP id j39mr4802691plb.335.1549988093752; Tue, 12 Feb 2019 08:14:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549988093; cv=none; d=google.com; s=arc-20160816; b=DN8EMNE3YtgrzMHUun2TbCzOTdNa066+JysTT67OpaWCzyhsYgjESFuf4pqpNIci5j oVTXuu3J1dKnG/XrwVqwUQdJo27r182IWGjGQAL83tFNIV0gBjNOo+FeZ6xDNsqGDiqr e+5Jd0F2TRRBHyjUAXsYor1DS0Cn2vLEq69ngoci+gii2gwk6kAyxmmjr5x5phlZutYf 1lbyc2rHcQqdZRR8WL2A6kP06FAxr1n/83Y3LXl+EIS9FG0TTFdICEMUKcic6ci+iy+7 l3UhaEUXGY9g08MGdVOItc3wV0bDMV36Ox66W6137gT7v/dWc0a+t45cuhAHP2GaJq7Z CzJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KsG+t4TKc8HTrcM4lZ9HeRo/tKDhxr2UPeHZ5jlgUCk=; b=Hy8LTpyxUlt6bOQ9Bbm0oTKwFqtgGVzFMs2Ed5DqT6Gcc57Dw45YEQDk88Fw6U4jMx mOBywHM94gGJvQVxC/UQx3j/pqgtynmMU4TM0wkiIGT64ZuRHsweYroHt01foU9qCGro XUeiRH+qAn9WMNVGCSm19GCziu5aiRuUM2vLgspPzxGpFwSPUqhYmhhPQJAYjLzLEcYP OysIa1X8OWkE1Wv2OkFSA3TJg7zMDBWntm/yjaKEXPXw4q7Pp26g/mYMQigN6u0ux4Vr DPSZ9Tq3/y5ixNaWCBmUxgIYs7eAopqmKZ+hBhuju9mzoWNO7B4awIi+aFOU52CMlSuq SlqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ikjNMkD8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23si11907113pgv.431.2019.02.12.08.14.37; Tue, 12 Feb 2019 08:14:53 -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; dkim=pass header.i=@kernel.org header.s=default header.b=ikjNMkD8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730914AbfBLQOF (ORCPT + 99 others); Tue, 12 Feb 2019 11:14:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:42768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727932AbfBLQOF (ORCPT ); Tue, 12 Feb 2019 11:14:05 -0500 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B068C2080F; Tue, 12 Feb 2019 16:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549988043; bh=MfvR07KhO4hUy5aezsun6TEaOoyAu2dzBjEtr8HajT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ikjNMkD8KN5rG7OBovDc3E0nOBaC/UBCAZRo33MZ8yqOvzlJXO3G0mp+mHpkbNI5z 8vG+yUhIX5NfOjVEyJd4x+n19/0C+SiA+dMHByUqJVPZhy3bq1BfmI/1LjbY1T40u3 XPIGhW/4piswn0vfgASf+rmjYM1im06YA01dPz7s= From: Masami Hiramatsu To: Ingo Molnar Cc: Masami Hiramatsu , peterz@infradead.org, Mathieu Desnoyers , linux-kernel , Andrea Righi , Steven Rostedt Subject: [PATCH -tip v3 06/10] kprobes: Prohibit probing on hardirq tracers Date: Wed, 13 Feb 2019 01:13:40 +0900 Message-Id: <154998802073.31052.17255044712514564153.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <154998785011.31052.1475728497912659748.stgit@devbox> References: <154998785011.31052.1475728497912659748.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) --- 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 @@ check_critical_timing(struct trace_array *tr, __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