public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: David Smith <dsmith@redhat.com>
Cc: linux-kernel@vger.kernel.org, prasanna@in.ibm.com,
	ananth@in.ibm.com, anil.s.keshavamurthy@intel.com,
	davem@davemloft.net
Subject: Re: [PATCH] module interface improvement for kprobes
Date: Sat, 05 Aug 2006 12:28:33 +1000	[thread overview]
Message-ID: <1154744913.28257.35.camel@localhost.localdomain> (raw)
In-Reply-To: <1154704652.15967.7.camel@dhcp-2.hsv.redhat.com>

On Fri, 2006-08-04 at 10:17 -0500, David Smith wrote:
> When inserting a kprobes probe into a loadable module, there isn't a way
> for the kprobes module to get a module reference (in order to find the
> base address of the module among perhaps other things).

OK, there's nothing fundamentally wrong with the idea of a new lookup
fn, but does kprobes really have a module name and an offset into the
load address of the module?  Or a symbol name?  Or an offset relative to
a specific section?

It seems to me that the last two options are best.  Both require
kallsyms, but I don't think that's unreasonable...

> +static inline long module_get_byname(const char *mod_name, struct module **mod)
> +{
> +	return 1;
> +}
...
> +long module_get_byname(const char *mod_name, struct module **mod)
> +{
> +	*mod = NULL;
>  
> +	/* We must hold module_mutex before calling find_module(). */
> +	if (mutex_lock_interruptible(&module_mutex) != 0)
> +		return -EINTR;
> +
> +	*mod = find_module(mod_name);
> +	mutex_unlock(&module_mutex);
> +	if (*mod) {
> +		if (! strong_try_module_get(*mod)) {
> +			*mod = NULL;
> +			return -EINVAL;
> +		}
> +	}
> +	return 0;
> +}

Your return values here are confused. Please just return struct module
*.  Also, there doesn't seem to be any reason for this function to exist
in the CONFIG_MODULES=n case.

Cheers!
Rusty,
-- 
Help! Save Australia from the worst of the DMCA: http://linux.org.au/law


  parent reply	other threads:[~2006-08-05  2:28 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
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 [this message]
  -- 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=1154744913.28257.35.camel@localhost.localdomain \
    --to=rusty@rustcorp.com.au \
    --cc=ananth@in.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=dsmith@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prasanna@in.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox