Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4007123imj; Tue, 12 Feb 2019 08:16:12 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ9LiIwXJEiKtMk2F0z1Jzu7TVTJheSKtml2OSx0bgNT3hlIN/YjjBmvbQG9K5uFGpiJvq8 X-Received: by 2002:a63:5761:: with SMTP id h33mr4320310pgm.283.1549988171988; Tue, 12 Feb 2019 08:16:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549988171; cv=none; d=google.com; s=arc-20160816; b=nHsU00Uxpuf3wYVU3D6DlrNSC9scBSCGSNdgx0q8C5sf7jgKX3fkxTYcdFR9l1niVw CBZxvL5OCF1lmtP5vjYJklnPFAWfl9HlJ/Ezd8n+TeGzjlCa27ILAab65yZpFA4CXoxE JHt2EwIm0L/GPkqyh0bWeRCECuNxnMGGlthLBKy23GWpX2PgwvlSVRe/LR+OY/+jmm6H byDc62rkIgzg7T9V4wer5/nd31+m9JGm5x6W0U+HsMDGwzrTF5dNdEIiJHGCsOgl2ivC kJnH6Elz5nHULDPzc3H/PEw0p4G7sqA0LaUeTxlXvwUwgW+YwriLWNYsL8ECTCBSuXaI UiJA== 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=VHA77cOyynXsBDp8O4QozjMTVfN1e13ky38OipFFi80=; b=hEYUWKOCBxmUi4uBWdQ3ufU3N1yGGsnxe59egPmW+ynoy3Ufkh21XxkOOptRnBlJZH /rIhAGltsGcrczo7BMj/dQ1BjKRA3IY3n55Q6fcyCvGn9Az/pG3X0amxI3pojX1p/rnD npJTrjTzVBRgU7lHoKYxjjt7xPSBrYx9HgpXAAE1c/ZvATURy/3TMD7Y0nh85XOp8g6N cQHTuB1UmsPDPff7Ejhw2wsJ7Rn/s0MPYWwQ+85RyStTjLsp6QBScmmPNkjlah5ELzgl q4cl8GhKyvIGLTUDmENmWv6ELcUjddhFXvZjc336acTkH6ndV9EtyKfOiY8CKTm4tvP/ x23w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t4Zk1RjI; 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 97si14084740ple.389.2019.02.12.08.15.55; Tue, 12 Feb 2019 08:16:11 -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=t4Zk1RjI; 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 S1730984AbfBLQP3 (ORCPT + 99 others); Tue, 12 Feb 2019 11:15:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:44052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730301AbfBLQP3 (ORCPT ); Tue, 12 Feb 2019 11:15:29 -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 B155921773; Tue, 12 Feb 2019 16:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549988128; bh=NGj09ZlYvwysKa4bog5Nt7sVBbwEh+ImPCiZvgE5neI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t4Zk1RjI5+UXq61nxM3NUP15hl6Yi8J9KD8zwDSG54AozNLAKsAkUqTSmubW8IaQ/ hKNjRXd+tV2Xa0hNgN2UK0V+laemq6jBBiUVb2Nc4czZ5Sntyc8MmnLYvpF9y9mjlg 6932fd+I+M3cwS9z93aA/Uy1Dd0xGJ+iwZlIsZM4= From: Masami Hiramatsu To: Ingo Molnar Cc: Masami Hiramatsu , peterz@infradead.org, Mathieu Desnoyers , linux-kernel , Andrea Righi , Steven Rostedt Subject: [PATCH -tip v3 09/10] kprobes: Prohibit probing on lockdep functions Date: Wed, 13 Feb 2019 01:15:05 +0900 Message-Id: <154998810578.31052.1680977921449292812.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 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 7f7db23fc002..c1653a1b57b7 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -50,6 +50,7 @@ #include #include #include +#include #include @@ -2796,6 +2797,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: @@ -2825,6 +2827,7 @@ void lockdep_hardirqs_off(unsigned long ip) } else debug_atomic_inc(redundant_hardirqs_off); } +NOKPROBE_SYMBOL(lockdep_hardirqs_off); /* * Softirqs will be enabled: @@ -3638,7 +3641,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; @@ -3871,6 +3875,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) {