Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2628997imu; Sun, 13 Jan 2019 06:25:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN4eW+J+fw04mzWtvHv74CttlPAkoipfjHz6YZnM/lIIiK6wniwaMLdTOrOTwHUeIzX4J19n X-Received: by 2002:a63:d846:: with SMTP id k6mr20182424pgj.251.1547389542917; Sun, 13 Jan 2019 06:25:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547389542; cv=none; d=google.com; s=arc-20160816; b=wVPsPvASoa35KZ9/VlrtbasPUpQfZgj6lyYTiMagPO4ktZmc7/DCI1NgPknIP/LbT/ rPRy96yJmdNCEMTb6dwdTuiHdvmZrEIHBNvZ1hiR3X2QgTMO1vcii3pSQT5Vf4oJ61PZ rhN25/X6pTJ5Y+EMqv/3hsqqOZXtL1aRleB0fig/DmmUP6gqcyGUfJsfMVpGU7HH+kKg 5RBUFHeW7/t/ps3W8ZxuXZxVPIE+TQMPkJrfGTDi2JR9pLyNXv/gxmdf9WvjEgMYpWCU YkYgl9+BHmsoGQ6pVdOXFEQQtqHK25d/q1yXByYli1L5oastHUIdxPK6+hRnwWB7ulGB 8Ccg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=B+rNm2CIwy9DWSI3Q35j8UePSnMCFBRahI8S7sB+jlI=; b=n9Cbj0i62cYXDqs6dhs1bGEkiwat3i8vu0Zdg1eHjYWHKr+c/RmlW1nm6XNQDxNAf/ PYDIEa6jCniTk/I5LeMzAUd9UJHP0PoCoxcIyfxWD9C2GzafzLjQaP4tn2mi14fCG9bZ I/IzjovV2O7LoLN9SkkkIhtofoFYaKDOhXTTSpI+E3mdp+tQUo315dsMf7H4cQ8NOyLe WPN8vXQgqCR5NbI6dH9Nw642AcfMcm8F67MDvZ0onpRvbSQqK/PEooiJkV9ya6bHob/P ghVX7vPYMOh6BlsjqYgrnzoaGKK7hEXIwOJncQVN+O+Zyj4EdGZYpDkkhCeYAJEPThI2 q5iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R+Drnj8Q; 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 c17si6434169pgl.385.2019.01.13.06.25.26; Sun, 13 Jan 2019 06:25:42 -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=R+Drnj8Q; 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 S1726645AbfAMOXS (ORCPT + 99 others); Sun, 13 Jan 2019 09:23:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:56584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726559AbfAMOXR (ORCPT ); Sun, 13 Jan 2019 09:23:17 -0500 Received: from devbox (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 55DFA2084C; Sun, 13 Jan 2019 14:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547389396; bh=1e+RLWNPAan2nk+hM4EKqEIL9x06MppQCoV5oOs/aEQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=R+Drnj8Q/fiLvKCk2ZdZn0q/UDo4RlGthmNzxBA4AzEQbRUQGyMLHeQQNxwVpdowq M/aCcShS7gS4mmzaZScerxk12c4lImdifaQX7V4tS9iR3tAwHNVxvwgtuqg8b4+yNF ZYk9cqe6FnPDI7mrsgppxdJprwb6Hzr4TriNOUSQ= Date: Sun, 13 Jan 2019 23:23:13 +0900 From: Masami Hiramatsu To: Andrea Righi Cc: Ingo Molnar , peterz@infradead.org, Mathieu Desnoyers , linux-kernel , Steven Rostedt Subject: Re: [PATCH v2 0/9] kprobes: Fix and improve blacklist symbols Message-Id: <20190113232313.33c2dd41b93eaf57a23ffbc2@kernel.org> In-Reply-To: <20190112133324.GA2009@xps-13> References: <154725993986.18060.2759150647140353514.stgit@devbox> <20190112133324.GA2009@xps-13> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 12 Jan 2019 14:33:24 +0100 Andrea Righi wrote: > On Sat, Jan 12, 2019 at 11:25:40AM +0900, Masami Hiramatsu wrote: > ... > > And I found several functions which must be blacklisted. > > - optprobe template code, which is just a template code and > > never be executed. Moreover, since it can be copied and > > reused, if we probe it, it modifies the template code and > > can cause a crash. ([1/9][2/9]) > > - functions which is called before kprobe_int3_handler() > > handles kprobes. This can cause a breakpoint recursion. ([3/9]) > > - IRQ entry text, which should not be probed since register/pagetable > > status has not been stable at that point. ([4/9]) > > - Suffixed symbols, like .constprop, .part etc. Those suffixed > > symbols never be blacklisted even if the non-suffixed version > > has been blacklisted. ([5/9]) > > - hardirq tracer also works before int3 handling. ([6/9]) > > - preempt_check debug function also is involved in int3 handling. > > ([7/9]) > > - RCU debug routine is also called before kprobe_int3_handler(). > > ([8/9]) > > - Some lockdep functions are also involved in int3 handling. > > ([9/9]) > > > > Of course there still may be some functions which can be called > > by configuration change, I'll continue to test it. > > Hi Masami, > > I think I've found another recursion problem. Could you include also > this one? Yeah, if I will make new version, but basically please feel free to send such blacklist update patch to LKML, me and Ingo :) > > Thanks, > > From: Andrea Righi > Subject: [PATCH] kprobes: prohibit probing on bsearch() > > Since kprobe breakpoing handler is using bsearch(), probing on this > routine can cause recursive breakpoint problem. > > int3 > ->do_int3() > ->ftrace_int3_handler() > ->ftrace_location() > ->ftrace_location_range() > ->bsearch() -> int3 > > Prohibit probing on bsearch(). > > Signed-off-by: Andrea Righi This looks good to me. Acked-by: Masami Hiramatsu Thank you, > --- > lib/bsearch.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lib/bsearch.c b/lib/bsearch.c > index 18b445b010c3..82512fe7b33c 100644 > --- a/lib/bsearch.c > +++ b/lib/bsearch.c > @@ -11,6 +11,7 @@ > > #include > #include > +#include > > /* > * bsearch - binary search an array of elements > @@ -53,3 +54,4 @@ void *bsearch(const void *key, const void *base, size_t num, size_t size, > return NULL; > } > EXPORT_SYMBOL(bsearch); > +NOKPROBE_SYMBOL(bsearch); > -- > 2.17.1 > -- Masami Hiramatsu