LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Srinivasa Ds <srinivasa@in.ibm.com>
Cc: Frederik Deweerdt <deweerdt@free.fr>,
	Christoph Hellwig <hch@infradead.org>,
	linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	jkenisto@us.ibm.com, anil.s.keshavamurthy@intel.com,
	prasanna@in.ibm.com, ananth@in.ibm.com
Subject: Re: [RFC] [PATCH] To list all active probes in the system---Take-2
Date: Fri, 9 Feb 2007 00:03:53 -0800	[thread overview]
Message-ID: <20070209000353.f4c2057e.akpm@linux-foundation.org> (raw)
In-Reply-To: <45CB0D87.8070808@in.ibm.com>

On Thu, 08 Feb 2007 17:16:15 +0530 Srinivasa Ds <srinivasa@in.ibm.com> wrote:

> +module_init(debugfs_kprobe_init);
> +#endif /* CONFIG_DEBUG_FS */
> +
>  __initcall(init_kprobes);

I think you'll find this doesn't work when loaded as a module: we only
support a single initcall per module.  (Which might be a bit dumb of us -
it's probably easy to fix and is an inconsistency between modular and
built-in).

<looks>

Oh, kernel/kprobes.o can't be linked as a module.  It looks like it could
be though?

You have a little race: debugfs_kprobe_init() will be called before
init_kprobes().  If someone were able to read from the debugfs files in
that window (they probably can't as we don't support modular kprobes.ko)
they'll crash the kernel.  I'll switch debugfs_kprobe_init() to
late_initcall to fix that.

There are quite a few things in there which could have static scope.


I'll apply this:



diff -puN kernel/kprobes.c~kprobes-list-all-active-probes-in-the-system-tidy kernel/kprobes.c
--- a/kernel/kprobes.c~kprobes-list-all-active-probes-in-the-system-tidy
+++ a/kernel/kprobes.c
@@ -836,12 +836,12 @@ static void __kprobes report_probe(struc
 		seq_printf(pi, "%p  %s  %p\n", p->addr, kprobe_type, p->addr);
 }
 
-void __kprobes *kprobe_seq_start(struct seq_file *f, loff_t *pos)
+static void __kprobes *kprobe_seq_start(struct seq_file *f, loff_t *pos)
 {
 	return (*pos < KPROBE_TABLE_SIZE) ? pos : NULL;
 }
 
-void __kprobes *kprobe_seq_next(struct seq_file *f, void *v, loff_t *pos)
+static void __kprobes *kprobe_seq_next(struct seq_file *f, void *v, loff_t *pos)
 {
 	(*pos)++;
 	if (*pos >= KPROBE_TABLE_SIZE)
@@ -849,12 +849,12 @@ void __kprobes *kprobe_seq_next(struct s
 	return pos;
 }
 
-void __kprobes kprobe_seq_stop(struct seq_file *f, void *v)
+static void __kprobes kprobe_seq_stop(struct seq_file *f, void *v)
 {
 	/* Nothing to do */
 }
 
-int __kprobes show_kprobe_addr(struct seq_file *pi, void *v)
+static int __kprobes show_kprobe_addr(struct seq_file *pi, void *v)
 {
 	struct hlist_head *head;
 	struct hlist_node *node;
@@ -879,7 +879,7 @@ int __kprobes show_kprobe_addr(struct se
 	return 0;
 }
 
-struct seq_operations kprobes_seq_ops = {
+static struct seq_operations kprobes_seq_ops = {
 	.start = kprobe_seq_start,
 	.next  = kprobe_seq_next,
 	.stop  = kprobe_seq_stop,
@@ -916,10 +916,10 @@ static int __kprobes debugfs_kprobe_init
 	return 0;
 }
 
-module_init(debugfs_kprobe_init);
+late_initcall(debugfs_kprobe_init);
 #endif /* CONFIG_DEBUG_FS */
 
-__initcall(init_kprobes);
+module_init(init_kprobes);
 
 EXPORT_SYMBOL_GPL(register_kprobe);
 EXPORT_SYMBOL_GPL(unregister_kprobe);
@@ -928,4 +928,3 @@ EXPORT_SYMBOL_GPL(unregister_jprobe);
 EXPORT_SYMBOL_GPL(jprobe_return);
 EXPORT_SYMBOL_GPL(register_kretprobe);
 EXPORT_SYMBOL_GPL(unregister_kretprobe);
-
_


  reply	other threads:[~2007-02-09  8:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-06  9:55 [RFC] [PATCH] To list all active probes in the system Srinivasa Ds
2007-02-06 10:06 ` Christoph Hellwig
2007-02-06 10:22   ` Srinivasa Ds
2007-02-06 14:47     ` Srinivasa Ds
2007-02-06 14:56       ` Frederik Deweerdt
2007-02-07  5:25         ` Srinivasa Ds
2007-02-07 22:27           ` Andrew Morton
2007-02-08 11:46             ` [RFC] [PATCH] To list all active probes in the system---Take-2 Srinivasa Ds
2007-02-09  8:03               ` Andrew Morton [this message]
2007-02-12  8:45               ` Andrew Morton
2007-02-12  9:29                 ` Ananth N Mavinakayanahalli
2007-02-06 10:13 ` [RFC] [PATCH] To list all active probes in the system Andrew Morton
2007-02-06 10:21   ` Srinivasa Ds
2007-02-06 20:36   ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070209000353.f4c2057e.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ananth@in.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=deweerdt@free.fr \
    --cc=hch@infradead.org \
    --cc=jkenisto@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prasanna@in.ibm.com \
    --cc=srinivasa@in.ibm.com \
    --cc=torvalds@linux-foundation.org \
    --subject='Re: [RFC] [PATCH] To list all active probes in the system---Take-2' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).