[RFC -mm][PATCH ] Patch to avoid probing __init functions using kprobes
Ananth N Mavinakayanahalli
ananth@in.ibm.com
Thu Dec 13 15:35:00 GMT 2007
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
More information about the Systemtap
mailing list