From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4901 invoked by alias); 26 Mar 2014 07:04:12 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 4885 invoked by uid 89); 26 Mar 2014 07:04:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail9.hitachi.co.jp Received: from mail9.hitachi.co.jp (HELO mail9.hitachi.co.jp) (133.145.228.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 26 Mar 2014 07:04:10 +0000 Received: from mlsv8.hitachi.co.jp (unknown [133.144.234.166]) by mail9.hitachi.co.jp (Postfix) with ESMTP id 310A837C9F; Wed, 26 Mar 2014 16:04:08 +0900 (JST) Received: from mfilter05.hitachi.co.jp by mlsv8.hitachi.co.jp (8.13.1/8.13.1) id s2Q7482O017158; Wed, 26 Mar 2014 16:04:08 +0900 Received: from vshuts04.hitachi.co.jp (vshuts04.hitachi.co.jp [10.201.6.86]) by mfilter05.hitachi.co.jp (Switch-3.3.4/Switch-3.3.4) with ESMTP id s2Q746DR006190; Wed, 26 Mar 2014 16:04:06 +0900 Received: from gxml20a.ad.clb.hitachi.co.jp (unknown [158.213.157.160]) by vshuts04.hitachi.co.jp (Postfix) with ESMTP id C760D140067; Wed, 26 Mar 2014 16:04:05 +0900 (JST) Received: from [10.198.220.54] by gxml20a.ad.clb.hitachi.co.jp (Switch-3.1.10/Switch-3.1.9) id 62Q7045I800003150; Wed, 26 Mar 2014 16:04:05 +0900 Message-ID: <53327BE1.906@hitachi.com> Date: Wed, 26 Mar 2014 07:04:00 -0000 From: Masami Hiramatsu User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Jeremy Fitzhardinge , x86@kernel.org, Andi Kleen , Ananth N Mavinakayanahalli , Arnd Bergmann , Peter Zijlstra , Frederic Weisbecker , Rusty Russell , "David S. Miller" , Chris Wright , Sandeepa Prabhu , fche@redhat.com, mingo@redhat.com, Rob Landley , "H. Peter Anvin" , Thomas Gleixner , Alok Kataria , systemtap@sourceware.org Subject: Re: [PATCH -tip v8 04/26] kprobes: Introduce NOKPROBE_SYMBOL() macro for blacklist References: <20140305115843.22766.8355.stgit@ltc230.yrl.intra.hitachi.co.jp> <20140305115911.22766.61140.stgit@ltc230.yrl.intra.hitachi.co.jp> <20140321204917.636820fa@gandalf.local.home> In-Reply-To: <20140321204917.636820fa@gandalf.local.home> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-q1/txt/msg00362.txt.bz2 (2014/03/22 9:49), Steven Rostedt wrote: > On Wed, 05 Mar 2014 20:59:11 +0900 > Masami Hiramatsu wrote: > > >> >> diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt >> index 0cfb00f..7062631 100644 >> --- a/Documentation/kprobes.txt >> +++ b/Documentation/kprobes.txt >> @@ -22,8 +22,9 @@ Appendix B: The kprobes sysctl interface >> >> Kprobes enables you to dynamically break into any kernel routine and >> collect debugging and performance information non-disruptively. You >> -can trap at almost any kernel code address, specifying a handler >> +can trap at almost any kernel code address(*), specifying a handler >> routine to be invoked when the breakpoint is hit. >> +(*: at some part of kernel code can not be trapped, see 1.5 Blacklist) > > "*: some parts of the kernel code can not be trapped," > >> >> There are currently three types of probes: kprobes, jprobes, and >> kretprobes (also called return probes). A kprobe can be inserted >> @@ -273,6 +274,19 @@ using one of the following techniques: >> or >> - Execute 'sysctl -w debug.kprobes_optimization=n' >> >> +1.5 Blacklist >> + >> +Kprobes can probe almost of the kernel except itself. This means > > s/almost/most/ > >> +that there are some functions where kprobes cannot probe. Probing >> +(trapping) such functions can cause recursive trap (e.g. double > > cause a recursive trap > >> +fault) or at least the nested probe handler never be called. > > "or the nested probe handler may never be called." > >> +Kprobes manages such functions as a blacklist. >> +If you want to add a function into the blacklist, you just need >> +to (1) include linux/kprobes.h and (2) use NOKPROBE_SYMBOL() macro >> +to specify a blacklisted function. >> +Kprobes checks given probe address with the blacklist and reject > > "checks the given probe address against the black list and rejects" > >> +registering if the given address is in the blacklist. > > registering it, if Thank you for helping ! :) >> diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h >> index 4582e8e..7730c1c 100644 >> --- a/arch/x86/include/asm/asm.h >> +++ b/arch/x86/include/asm/asm.h >> @@ -57,6 +57,12 @@ >> .long (from) - . ; \ >> .long (to) - . + 0x7ffffff0 ; \ >> .popsection >> + >> +# define _ASM_NOKPROBE(entry) \ >> + .pushsection "_kprobe_blacklist","aw" ; \ >> + _ASM_ALIGN ; \ >> + _ASM_PTR (entry); \ >> + .popsection >> #else >> # define _ASM_EXTABLE(from,to) \ >> " .pushsection \"__ex_table\",\"a\"\n" \ >> @@ -71,6 +77,7 @@ >> " .long (" #from ") - .\n" \ >> " .long (" #to ") - . + 0x7ffffff0\n" \ >> " .popsection\n" >> +/* For C file, we already have NOKPROBE_SYMBOL macro */ >> #endif >> >> #endif /* _ASM_X86_ASM_H */ >> diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c >> index 1b10af8..4c785fd 100644 >> --- a/arch/x86/kernel/paravirt.c >> +++ b/arch/x86/kernel/paravirt.c >> @@ -23,6 +23,7 @@ >> #include >> #include >> #include >> +#include >> >> #include >> #include >> @@ -389,6 +390,9 @@ __visible struct pv_cpu_ops pv_cpu_ops = { >> .end_context_switch = paravirt_nop, >> }; >> >> +/* At this point, native_get_debugreg has real function entry */ > > "has a real" OK, I'll fix them all ;) Thank you, -- Masami HIRAMATSU IT Management Research Dept. Linux Technology Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: masami.hiramatsu.pt@hitachi.com