From patchwork Thu Jul 9 13:53:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pratyush Anand X-Patchwork-Id: 6756371 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 446D7C05AC for ; Thu, 9 Jul 2015 13:56:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6CBEC20606 for ; Thu, 9 Jul 2015 13:56:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9DC0620607 for ; Thu, 9 Jul 2015 13:56:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZDCH4-0001yb-Ew; Thu, 09 Jul 2015 13:54:02 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZDCH1-0001sM-P0 for linux-arm-kernel@lists.infradead.org; Thu, 09 Jul 2015 13:54:00 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 0238435B8AD; Thu, 9 Jul 2015 13:53:38 +0000 (UTC) Received: from localhost (unused [10.10.50.67] (may be forged)) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t69DraUW011682; Thu, 9 Jul 2015 09:53:37 -0400 Date: Thu, 9 Jul 2015 19:23:35 +0530 From: Pratyush Anand To: Masami Hiramatsu , will.deacon@arm.com Subject: Re: [PATCH 1/2] arm64: Blacklist non-kprobe-able symbols Message-ID: <20150709135335.GC16331@dhcppc13.redhat.com> References: <9994841a0b0a8194a6dcc1b6af148ba358488c62.1436158027.git.panand@redhat.com> <559A6257.60608@hitachi.com> <20150706114920.GB17305@dhcppc13.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150706114920.GB17305@dhcppc13.redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150709_065359_841584_428F08CE X-CRM114-Status: GOOD ( 20.08 ) X-Spam-Score: -7.3 (-------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux@arm.linux.org.uk, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, dave.long@linaro.org, steve.capper@linaro.org, wcohen@redhat.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 06/07/2015:05:19:20 PM, Pratyush Anand wrote: > On 06/07/2015:08:11:19 PM, Masami Hiramatsu wrote: > > On 2015/07/06 14:03, Pratyush Anand wrote: > > > Add all function symbols which are called from do_debug_exception under > > > NOKPROBE_SYMBOL, as they can not kprobed. > > > > Could you tell me how you checked that? from the code? > > Well.. I found out that some of the symbol like single_step_handler > does not allow kprobing, and then it seemed logical to me that we > should not allow kprobing of any symbols which are called in the path > of do_debug_exception. So, manually :( I reviewed the code and put > NOKPROBE_SYMBOL across all those. > > However, now I am doing some more tests and as I said in previous > reply, there are still few symbols like (_mcount) which is creating > problem with following simple test and I need to look into that. In > case of _mcount, I do not see any print and its complete freeze. > Once these two patches are applied, I do not see any issue (at least) in enabling kprobes for all the symbols of /proc/kallsyms, except _mcount. Blacklisting _mcount seems reasonable to me, as this is called from every function and so from do_debug_exception as well. There might still be some path which can create issue if a kprobe is inserted there, but I do not see any way to find them. So, I will send V2 with following updates.Please let me know if there is any other concern. ~Pratyush PS: Some related details are here: http://marc.info/?l=linux-kernel&m=143644472722751 --- a/arch/arm64/kernel/arm64ksyms.c +++ b/arch/arm64/kernel/arm64ksyms.c @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -64,4 +65,5 @@ EXPORT_SYMBOL(test_and_change_bit); #ifdef CONFIG_FUNCTION_TRACER EXPORT_SYMBOL(_mcount); +NOKPROBE_SYMBOL(_mcount); #endif