All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
To: Christoph Hellwig <hch@infradead.org>,
	David Smith <dsmith@redhat.com>,
	linux-kernel@vger.kernel.org, rusty@rustcorp.com.au,
	prasanna@in.ibm.com, anil.s.keshavamurthy@intel.com,
	davem@davemloft.net
Subject: Re: [PATCH] module interface improvement for kprobes
Date: Mon, 7 Aug 2006 10:35:17 +0530	[thread overview]
Message-ID: <20060807050517.GA18437@in.ibm.com> (raw)
In-Reply-To: <20060807045213.GA12898@in.ibm.com>

On Mon, Aug 07, 2006 at 10:22:13AM +0530, Ananth N Mavinakayanahalli wrote:
> On Fri, Aug 04, 2006 at 04:57:11PM +0100, Christoph Hellwig wrote:
> > > {
> > > 	/* grab the module, making sure it won't get unloaded until
> > > 	 * we're done */
> > > 	const char *mod_name = "joydev";
> > > 	if (module_get_byname(mod_name, &mod) != 0)
> > > 		return 1;
> > > 
> > > 	/* Specify the address/offset where you want to insert
> > > 	 * probe.  If this were a real kprobe module, we'd "relocate"
> > > 	 * our probe address based on the load address of the module
> > > 	 * we're interested in. */
> > > 	kp.addr = (kprobe_opcode_t *) mod->module_core + 0;
> > > 
> > > 	/* All set to register with Kprobes */
> > >         register_kprobe(&kp);
> > > 	return 0;
> > > }
> > 
> > This interface is horrible.  You actual patch looks good to me, but it
> > I can't see why you would need it.  kallsyms_lookup_name deals with modules
> > transparently and you shouldn't put a probe at a relative offset into a
> > module but only at a symbol you could find with kallsys.
> > 
> > That beeing said we should probably change the kprobes interface to
> > automatically do the kallsysms name lookup for the caller.  It would simplify
> > the kprobes interface and allow us to get rid of the kallsyms_lookup_name
> > export that doesn't have a valid use except for kprobes.  With
> > that change the example kprobe would look like:
> 
> This sounds like a good idea. How about we still allow .addr atleast for
> users who know what they are doing and would want to just specify a text
> addr?
> 
> > static struct kprobe kp = {
> 	.addr		= <addr>
> 
> > 	.pre_handler	= handler_pre,
> > 	.post_handler	= handler_post,
> > 	.fault_handler	= handler_fault,
> > 	.symbol_name	= "do_fork",
> > };
> 
> The symbol_name lookup can then be done when only when .addr is non-NULL.

Duh! I meant to say lookup when .addr is NULL.

Ananth

  reply	other threads:[~2006-08-07  5:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-04 15:17 [PATCH] module interface improvement for kprobes David Smith
2006-08-04 15:57 ` Christoph Hellwig
2006-08-04 18:30   ` David Smith
2006-08-05 11:35     ` Christoph Hellwig
2006-08-05 21:10       ` Frank Ch. Eigler
2006-08-07  4:52   ` Ananth N Mavinakayanahalli
2006-08-07  5:05     ` Ananth N Mavinakayanahalli [this message]
2006-08-08 15:39     ` David Smith
2006-08-04 16:00 ` Randy.Dunlap
2006-08-04 19:51   ` David Smith
2006-08-05  2:28 ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2006-08-04 23:00 Chuck Ebbert

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=20060807050517.GA18437@in.ibm.com \
    --to=ananth@in.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=dsmith@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prasanna@in.ibm.com \
    --cc=rusty@rustcorp.com.au \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.