lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <200608041902_MC3-1-C71C-6FC9@compuserve.com>
Date:	Fri, 4 Aug 2006 19:00:33 -0400
From:	Chuck Ebbert <76306.1226@...puserve.com>
To:	David Smith <dsmith@...hat.com>
Cc:	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Prasanna S Panchamukhi <prasanna@...ibm.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
	"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH] module interface improvement for kprobes

In-Reply-To: <1154721061.15967.31.camel@...p-2.hsv.redhat.com>

On Fri, 04 Aug 2006 14:51:01 -0500, David Smith wrote:

> > > I've added a new function, module_get_byname(), that looks up a module
> > > by name and returns the module reference.  Note that module_get_byname()
> > > also increments the module reference count.  It does this so that the
> > > module won't be unloaded between the time that module_get_byname() is
> > > called and register_kprobe() is called.

Your patch is word-wrapped.

Also:

> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -291,7 +291,27 @@ static struct module *find_module(const 
>       }
>       return NULL;
>  }
> +  
> +int 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)) {

What keeps the module from going away between the mutex_unlock() and
strong_try_module_get()? It needs to be something like this:

        *mod = find_module(mod_name);
        if (*mod)
                ret = strong_try_module_get(*mod);
        mutex_unlock(&module_mutex);
        if (!ret) {
                *mod = NULL;
                return -EINVAL;
        }

> +                     *mod = NULL;
> +                     return -EINVAL;
> +             }
> +     }
> +     return 0;
> +}
> +EXPORT_SYMBOL_GPL(module_get_byname);
> + 
>  #ifdef CONFIG_SMP
>  /* Number of blocks used and allocated. */
>  static unsigned int pcpu_num_used, pcpu_num_allocated;

-- 
Chuck

-
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ