Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1243641imu; Fri, 11 Jan 2019 18:32:03 -0800 (PST) X-Google-Smtp-Source: ALg8bN76tmfaVFki9a2vd29GEfYl2nZaMVKXDW15+cngvA0fxECubHxSHVeMX4Q10N8VeGcATQJN X-Received: by 2002:a63:4926:: with SMTP id w38mr14898451pga.353.1547260323745; Fri, 11 Jan 2019 18:32:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547260323; cv=none; d=google.com; s=arc-20160816; b=uO6PtEbwJxvoAKKgrHJQnOVd49wJ4SmJVe6aZp+99rtQzkV4g4dyf7XKje3w67tiYp ljLLqNQefImQElJakbl5QVmTfl/Y0QzN6rUqYDteeOpzJioCUr82GyfGz6r9kB77JsQN arCg8YG2XMrtpjrcTdSeEptVeaVdR25E9OHvTbQ6WfTqgaCjtc1RWRTNIdrmQ+CFUreq Thadp0st8U5qwcuS7opMoapdN3eEwFyloAuLBxGdThVlxAW7lHTpHWNKQeFs+yub7fTP gI9RRKam7HEOrE7Rghp2hGGEPS6n7p49rPapHD3vRuhwjyfWK5o4y4rXJOcUyoQfvC9b QiDw== 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=of0UFbfcZPAMXvWLKwfEJvush91Dr4Blx6M3XON2mRY=; b=hZDAgfVDVhuhRqumxIetWAv3uMnQfFD70gnl3P1n62t0AAs1lnNVXzrHSMfOkhGp8l lP5XulD32SxhBK0rRHpyjMxUSOluM8l3Y2zVUvh9UVUbz/ZXW9BNSrSmo4fQbNMVbxKJ MnzI2GGcv6ac8Y0OuLRktIuKsDJ7lOlAJI3eVkWlrWrLw2lUruNoGNTUxWTllDt5tL5y iAtuJZjyjtR1jHGC8K/kBjt6uJLr6KV77dwqngD6nG795/m4V9HD9PTuDsg6E1+MB+S8 dmmXqnpzzyDbDWLuQ6JjK92EEadccjc7pCG/qyC/Pyi0uatAHgDKVSb5NZtiw3KzQuxL W95A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="cX/d58a/"; 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 bj11si32753173plb.21.2019.01.11.18.31.47; Fri, 11 Jan 2019 18:32:03 -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="cX/d58a/"; 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 S1726582AbfALCaT (ORCPT + 99 others); Fri, 11 Jan 2019 21:30:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:49246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbfALCaT (ORCPT ); Fri, 11 Jan 2019 21:30:19 -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 93CFD204FD; Sat, 12 Jan 2019 02:30:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547260218; bh=cOlAHv51eBswt07zXB4jFJAKiWwANnHtBJxD9PP7ZOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cX/d58a/PL273eYdQOlJhUk8/PUEx/pdQOH5egfUinTeT4PDN6TGWi1fi4VN+vm4r yBcmrxH8fuFFQJtZmqoZUc4n0o8+tGUgGjNjkSMRIY/AUgF8f5uiSIRSoJv1oLfKBB FtSm7C0mXwGbUBhg5elsKS5TyTFqp/llf3z2GIwU= From: Masami Hiramatsu To: Ingo Molnar Cc: Masami Hiramatsu , peterz@infradead.org, Mathieu Desnoyers , linux-kernel , Andrea Righi , Steven Rostedt Subject: [PATCH v2 9/9] kprobes: Prohibit probing on lockdep functions Date: Sat, 12 Jan 2019 11:29:55 +0900 Message-Id: <154726019565.18060.11682510369627582640.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <154725993986.18060.2759150647140353514.stgit@devbox> References: <154725993986.18060.2759150647140353514.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 Some lockdep functions can be involved in breakpoint handling and probing on those functions can cause a breakpoint recursion. Prohibit probing on those functions by blacklist. Signed-off-by: Masami Hiramatsu --- kernel/locking/lockdep.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 95932333a48b..bc35a54ae3d4 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -50,6 +50,7 @@ #include #include #include +#include #include @@ -2814,6 +2815,7 @@ void lockdep_hardirqs_on(unsigned long ip) __trace_hardirqs_on_caller(ip); current->lockdep_recursion = 0; } +NOKPROBE_SYMBOL(lockdep_hardirqs_on); /* * Hardirqs were disabled: @@ -2843,6 +2845,7 @@ void lockdep_hardirqs_off(unsigned long ip) } else debug_atomic_inc(redundant_hardirqs_off); } +NOKPROBE_SYMBOL(lockdep_hardirqs_off); /* * Softirqs will be enabled: @@ -3650,7 +3653,8 @@ __lock_release(struct lockdep_map *lock, int nested, unsigned long ip) return 0; } -static int __lock_is_held(const struct lockdep_map *lock, int read) +static nokprobe_inline +int __lock_is_held(const struct lockdep_map *lock, int read) { struct task_struct *curr = current; int i; @@ -3883,6 +3887,7 @@ int lock_is_held_type(const struct lockdep_map *lock, int read) return ret; } EXPORT_SYMBOL_GPL(lock_is_held_type); +NOKPROBE_SYMBOL(lock_is_held_type); struct pin_cookie lock_pin_lock(struct lockdep_map *lock) {