Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752023AbbHLVrZ (ORCPT ); Wed, 12 Aug 2015 17:47:25 -0400 Received: from mail9.hitachi.co.jp ([133.145.228.44]:44871 "EHLO mail9.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751093AbbHLVrY (ORCPT ); Wed, 12 Aug 2015 17:47:24 -0400 From: =?utf-8?B?5bmz5p2+6ZuF5bezIC8gSElSQU1BVFXvvIxNQVNBTUk=?= To: "'Steve Capper'" , "linux-kernel@vger.kernel.org" CC: "will.deacon@arm.com" , "sandeepa.s.prabhu@gmail.com" , "dave.long@linaro.org" , "catalin.marinas@arm.com" , "linux@arm.linux.org.uk" , "wcohen@redhat.com" , "tixy@linaro.org" , "ananth@in.ibm.com" , "anil.s.keshavamurthy@intel.com" , "davem@davemloft.net" , "broonie@kernel.org" Subject: RE: [PATCH] kprobes: Update examples to target _do_fork Thread-Topic: [PATCH] kprobes: Update examples to target _do_fork Thread-Index: AQHQ1SAFccy1uOpkTEaqfjA1BiKZPp4I5aiA Date: Wed, 12 Aug 2015 21:47:18 +0000 Message-ID: <50399556C9727B4D88A595C8584AAB37524B7E65@GSjpTKYDCembx32.service.hitachi.net> References: <1439398655-9357-1-git-send-email-steve.capper@linaro.org> In-Reply-To: <1439398655-9357-1-git-send-email-steve.capper@linaro.org> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.198.219.34] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t7CLlVXM021205 Content-Length: 3133 Lines: 86 > From: Steve Capper [mailto:steve.capper@linaro.org] > > In commit 3033f14ab78c ("clone: support passing tls argument via C > rather than pt_regs magic"), the kernel calls _do_fork in places where > it previously called do_fork. > > Unfortunately, the kprobe examples target do_fork; thus no events > appear to fire when one runs the example modules. > > This commit updates the kprobe example code s.t. _do_fork is targeted > instead, and the examples work as expected. Oops, right! I've found it on ftrace-test, but missed on kprobes examples :( > > Signed-off-by: Steve Capper Acked-by: Masami Hiramatsu Thank you! > --- > samples/kprobes/jprobe_example.c | 8 ++++---- > samples/kprobes/kprobe_example.c | 2 +- > samples/kprobes/kretprobe_example.c | 2 +- > 3 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/samples/kprobes/jprobe_example.c b/samples/kprobes/jprobe_example.c > index 9119ac6..11dd54b 100644 > --- a/samples/kprobes/jprobe_example.c > +++ b/samples/kprobes/jprobe_example.c > @@ -23,9 +23,9 @@ > */ > > /* Proxy routine having the same arguments as actual do_fork() routine */ > -static long jdo_fork(unsigned long clone_flags, unsigned long stack_start, > +static long j_do_fork(unsigned long clone_flags, unsigned long stack_start, > unsigned long stack_size, int __user *parent_tidptr, > - int __user *child_tidptr) > + int __user *child_tidptr, unsigned long tls) > { > pr_info("jprobe: clone_flags = 0x%lx, stack_start = 0x%lx " > "stack_size = 0x%lx\n", clone_flags, stack_start, stack_size); > @@ -36,9 +36,9 @@ static long jdo_fork(unsigned long clone_flags, unsigned long stack_start, > } > > static struct jprobe my_jprobe = { > - .entry = jdo_fork, > + .entry = j_do_fork, > .kp = { > - .symbol_name = "do_fork", > + .symbol_name = "_do_fork", > }, > }; > > diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c > index 51d459c..597e101 100644 > --- a/samples/kprobes/kprobe_example.c > +++ b/samples/kprobes/kprobe_example.c > @@ -16,7 +16,7 @@ > > /* For each probe you need to allocate a kprobe structure */ > static struct kprobe kp = { > - .symbol_name = "do_fork", > + .symbol_name = "_do_fork", > }; > > /* kprobe pre_handler: called just before the probed instruction is executed */ > diff --git a/samples/kprobes/kretprobe_example.c b/samples/kprobes/kretprobe_example.c > index 1041b67..a270535 100644 > --- a/samples/kprobes/kretprobe_example.c > +++ b/samples/kprobes/kretprobe_example.c > @@ -25,7 +25,7 @@ > #include > #include > > -static char func_name[NAME_MAX] = "do_fork"; > +static char func_name[NAME_MAX] = "_do_fork"; > module_param_string(func, func_name, NAME_MAX, S_IRUGO); > MODULE_PARM_DESC(func, "Function to kretprobe; this module will report the" > " function's execution time"); > -- > 2.1.0 ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?