Re: [PATCH] module interface improvement for kprobes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux