This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [RFC -mm][PATCH ] Patch to avoid probing __init functions using kprobes
- From: Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>
- To: Srinivasa Ds <srinivasa at in dot ibm dot com>
- Cc: Masami Hiramatsu <mhiramat at redhat dot com>, Jim Keniston <jkenisto at us dot ibm dot com>, Roland McGrath <roland at redhat dot com>, Arjan van de Ven <arjan at infradead dot org>, anil dot s dot keshavamurthy at intel dot com, davem at davemloft dot net, systemtap-ml <systemtap at sources dot redhat dot com>
- Date: Thu, 13 Dec 2007 21:05:19 +0530
- Subject: Re: [RFC -mm][PATCH ] Patch to avoid probing __init functions using kprobes
- References: <475DC362.9000707@redhat.com> <4760EAAE.7090303@in.ibm.com> <20071213082326.GA10642@in.ibm.com> <200712131651.18077.srinivasa@in.ibm.com>
- Reply-to: ananth at in dot ibm dot com
On Thu, Dec 13, 2007 at 04:51:18PM +0530, Srinivasa Ds wrote:
> ines: 102
>
> On Thursday 13 Dec 2007 1:53:26 pm Ananth N Mavinakayanahalli wrote:
> > On Thu, Dec 13, 2007 at 01:47:50PM +0530, Srinivasa Ds wrote:
> > > Ananth N Mavinakayanahalli wrote:
> > > >On Wed, Dec 12, 2007 at 08:21:01PM -0500, Masami Hiramatsu wrote:
> > > >>Masami Hiramatsu wrote:
> > > >>>Finally, I reproduced it by executing a command below:
> > > >>>% stap -e 'probe kernel.function("migration_init"){}'
> > > >
> > > >That does seem like the right thing to do. This also needs to live in
> > > >common code.
> > > >
> > > >Srini,
> > > >Want to take a stab at it?
> > >
>
> This patch taken against the 2.6.24-rc4-mm1 fixes the problem
> of probing __init functions.I have reused the code from extable.c
> and modified the kprobes.c accordingly.
>
> Since we are checking __init functions in __register_kprobe, there is
> no need to call kernel_noninit_text_address() in register_kretprobe.
>
>
> Signed-off-by: Srinivasa DS <srinivasa@in.ibm.com>
>
>
> ---
> include/linux/kernel.h | 1 +
> kernel/extable.c | 17 ++++++++++++++++-
> kernel/kprobes.c | 4 ++--
> 3 files changed, 19 insertions(+), 3 deletions(-)
>
> Index: linux-2.6.24-rc4/include/linux/kernel.h
> ===================================================================
> --- linux-2.6.24-rc4.orig/include/linux/kernel.h
> +++ linux-2.6.24-rc4/include/linux/kernel.h
> @@ -169,6 +169,7 @@ extern unsigned long long memparse(char
> extern int core_kernel_text(unsigned long addr);
> extern int __kernel_text_address(unsigned long addr);
> extern int kernel_text_address(unsigned long addr);
> +extern int kernel_noninit_text_address(unsigned long addr);
^^^^^^^^^^^
I prefer a different name non_init_kernel_text() perhaps?
> struct pid;
> extern struct pid *session_of_pgrp(struct pid *pgrp);
>
> Index: linux-2.6.24-rc4/kernel/extable.c
> ===================================================================
> --- linux-2.6.24-rc4.orig/kernel/extable.c
> +++ linux-2.6.24-rc4/kernel/extable.c
> @@ -40,11 +40,18 @@ const struct exception_table_entry *sear
> return e;
> }
>
> -int core_kernel_text(unsigned long addr)
> +static int core_kernel_noninit_text(unsigned long addr)
^^^^^^^
spurious whitespace
Ananth