Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2796547ybk; Tue, 12 May 2020 08:20:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyphiHPbNNonCU87bEvw2wG6/dg+BrE2z8ztyNKx1QkfDtMxnPT/zfEmmF6qfD32pYa8wBZ X-Received: by 2002:a50:f017:: with SMTP id r23mr2493574edl.290.1589296855252; Tue, 12 May 2020 08:20:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589296855; cv=none; d=google.com; s=arc-20160816; b=sMX1WQnHS2E6X5kep4GPkuN6xi5yh/XT+xXVK2eflS7UioH1fFW0DRF4/zid5elo1Z i4+lydlHdYRh5QL5mrp2FwYCVVW3H6BNk+zBU7GuA9mOgrxnW9CR/h9t08IDKVMIZba2 Ygx5bHYFxJnRVw/9/rj1K0lEY7DAuDCzUdvnhUY9kkOsoZqsCoi2UTaYhWCbieRkfNWo ir96dNz5kPrkhJeiCxLVXSQPpWCybbOoorUffNfe5tNQLH1LY5Oi44m228S4e2E0RmIX OabOxuNYd3Cpm0g3csT1v+HD9fVkmSzJcGRdZY0OPOluLvs0ZQKnLtuILbgL+a3CGrJ3 1+rA== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=AlkygX2ehukIR6zpTDP10uIqyDPfZUB3xxgfsiHNzgg=; b=bQyasxjY8NVL2gDIktbyLah+uP6JktcKelRdym2IYh0UXY/Ib6U+PHfZXu8hhFtHRi dgdeV3IWKLhy5o86a7H93QVFXPmJv9/+iCK+vXpod6EnT6mgmP6J1kAMMJ78P/O6SAq7 /XX2dCLiUjMCD95KHNKYMZx0kM9ibKG2z8YV68LSLzB0SSxveFDB5t7g1+J9qqMoAbbr 0pHJsI9/Frz+JwI4GRfb58k7eVp6xhXNzaKnSbkPGeUqDvriwtjxW0uMY0ec4LIvhWrn Py+TpkGG9f9JU64WYk7EIlTNbZjBYOD5fp/1hdMFvnKl1m1El7Z/730r+ntUcP6I5lmM fWqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x13si4659396ejb.364.2020.05.12.08.20.31; Tue, 12 May 2020 08:20:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730423AbgELPTG (ORCPT + 99 others); Tue, 12 May 2020 11:19:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726055AbgELPTD (ORCPT ); Tue, 12 May 2020 11:19:03 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A0F4C061A0E; Tue, 12 May 2020 08:19:03 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jYWgN-0007EM-Og; Tue, 12 May 2020 17:18:59 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 57A471C0475; Tue, 12 May 2020 17:18:59 +0200 (CEST) Date: Tue, 12 May 2020 15:18:59 -0000 From: "tip-bot2 for Masami Hiramatsu" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/kprobes] kprobes: Lock kprobe_mutex while showing kprobe_blacklist Cc: Masami Hiramatsu , Thomas Gleixner , Alexandre Chartre , Peter Zijlstra , x86 , LKML In-Reply-To: <20200505134059.571125195@linutronix.de> References: <20200505134059.571125195@linutronix.de> MIME-Version: 1.0 Message-ID: <158929673928.390.10899451832905837154.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the core/kprobes branch of tip: Commit-ID: 4fdd88877e5259dcc5e504dca449acc0324d71b9 Gitweb: https://git.kernel.org/tip/4fdd88877e5259dcc5e504dca449acc0324d71b9 Author: Masami Hiramatsu AuthorDate: Thu, 26 Mar 2020 23:49:36 +09:00 Committer: Thomas Gleixner CommitterDate: Tue, 12 May 2020 17:15:31 +02:00 kprobes: Lock kprobe_mutex while showing kprobe_blacklist Lock kprobe_mutex while showing kprobe_blacklist to prevent updating the kprobe_blacklist. Signed-off-by: Masami Hiramatsu Signed-off-by: Thomas Gleixner Reviewed-by: Alexandre Chartre Acked-by: Peter Zijlstra Link: https://lkml.kernel.org/r/20200505134059.571125195@linutronix.de --- kernel/kprobes.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 2625c24..570d608 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -2420,6 +2420,7 @@ static const struct file_operations debugfs_kprobes_operations = { /* kprobes/blacklist -- shows which functions can not be probed */ static void *kprobe_blacklist_seq_start(struct seq_file *m, loff_t *pos) { + mutex_lock(&kprobe_mutex); return seq_list_start(&kprobe_blacklist, *pos); } @@ -2446,10 +2447,15 @@ static int kprobe_blacklist_seq_show(struct seq_file *m, void *v) return 0; } +static void kprobe_blacklist_seq_stop(struct seq_file *f, void *v) +{ + mutex_unlock(&kprobe_mutex); +} + static const struct seq_operations kprobe_blacklist_seq_ops = { .start = kprobe_blacklist_seq_start, .next = kprobe_blacklist_seq_next, - .stop = kprobe_seq_stop, /* Reuse void function */ + .stop = kprobe_blacklist_seq_stop, .show = kprobe_blacklist_seq_show, };