[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141021164835.GB10290@in.ibm.com>
Date: Tue, 21 Oct 2014 22:18:35 +0530
From: Ananth N Mavinakayanahalli <ananth@...ibm.com>
To: Jiri Kosina <jkosina@...e.cz>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
linux-kernel@...r.kernel.org, Josh Poimboeuf <jpoimboe@...hat.com>,
Seth Jennings <sjenning@...hat.com>
Subject: Re: [PATCH] kprobes: add kprobe_is_function_probed()
On Tue, Oct 21, 2014 at 05:48:30PM +0200, Jiri Kosina wrote:
> kernel/kprobes.c | 28 ++++++++++++++++++++++++++++
> 2 files changed, 33 insertions(+)
>
> diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
> index f7296e5..f760555 100644
> --- a/include/linux/kprobes.h
> +++ b/include/linux/kprobes.h
> @@ -384,6 +384,7 @@ int disable_kprobe(struct kprobe *kp);
> int enable_kprobe(struct kprobe *kp);
>
> void dump_kprobe(struct kprobe *kp);
> +bool kprobe_is_function_probed(const char *name);
Better name? function_is_kprobed() or such?
...
> +bool kprobe_is_function_probed(const char *name)
> +{
> + struct hlist_head *head;
> + struct kprobe *p, *kp;
kp not used
> + const char *sym = NULL;
> + unsigned long offset = 0;
> + unsigned int i;
> + char *modname, namebuf[KSYM_NAME_LEN];
> +
> + preempt_disable();
> + for (i = 0; i < KPROBE_TABLE_SIZE; i++) {
> + head = &kprobe_table[i];
> + hlist_for_each_entry_rcu(p, head, hlist) {
> + sym = kallsyms_lookup((unsigned long)p->addr,
> + NULL, &offset, &modname,
> + namebuf);
> + if (!strcmp(sym, name))
Don't you want a strncmp instead?
Ananth
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists