linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Anand H. Krishnan" <anandhkrishnan@yahoo.co.in>
To: Jesper Juhl <jesper.juhl@gmail.com>,
	Ashutosh Naik <ashutosh.naik@gmail.com>
Cc: linux-kernel@vger.kernel.org, rusty@rustcorp.com.au,
	rth@redhat.com, akpm@osdl.org, Greg KH <greg@kroah.com>,
	anandhkrishnan@yahoo.co.in
Subject: Re: [RFC][PATCH] Prevent overriding of Symbols in the Kernel, avoiding Undefined behaviour
Date: Tue, 13 Dec 2005 00:23:50 -0800 (PST)	[thread overview]
Message-ID: <20051213082350.11599.qmail@web8605.mail.in.yahoo.com> (raw)
In-Reply-To: <9a8748490512121425r63cba7axab114f80746ee066@mail.gmail.com>

Hi,


> I'm wondering, doesn't this take quite a long time? 
> Too long to hold
> a spinlock for?
> 
> Of course we need locking to prevent other module
> loads to modify the
> symbol table while we are checking this one, but to
> prevent the kernel
> from stalling everything else for a long time,
> wouldn't it be better
> to use a semaphore (we can sleep with those -
> right?) and an explicit
> schedule() call in the loop(s)?   Or am I completely
> out in outere
> space with that thought?
> 

Both at the time of loading a module and while
unloading a 
module module_mutex is acquired. In the first place we
wer
e not planning to take the spinlock at all. But saw
that r
esolve_symbol does that and hence wasn't sure whether 
the
lock should be acquired. 


> Shouldn't this printk() be using KERN_ERROR ?
> 
> 	printk(KERN_ERROR "%s: Duplicate Exported Symbol
> found in %s\n",
> 
> 
> > +			strtab + index, mod->name);
> > +	return -ENOEXEC;
> > +duplicate_gpl_sym:
> > +	spin_unlock_irq(&modlist_lock);
> > +	printk("%s: Duplicate Exported Symbol found in
> %s\n",
> > +			strtab + index, mod->name);
> > +	return -ENOEXEC;
> > +}
> 
> Why 3 different exit paths? and 2 of them are even
> identical. Why not
> something like this instead? :
> 
> {
> ...
>     if (unlikely(value) {
>         ret = -ENOEXEC;
>         goto out;
>     }
> ...
>  out:
>     spin_unlock_irq();
>     if (ret)
>         printk();
>     return ret;
> }
> 

We will send an updated patch with the modifications.

Thanks,
Anand


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

  reply	other threads:[~2005-12-13  8:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-12 12:39 [RFC][PATCH] Prevent overriding of Symbols in the Kernel, avoiding Undefined behaviour Ashutosh Naik
2005-12-12 12:44 ` Ashutosh Naik
2005-12-12 22:25   ` Jesper Juhl
2005-12-13  8:23     ` Anand H. Krishnan [this message]
2005-12-12 19:13 ` Andrew Morton
2005-12-12 19:27   ` Richard Henderson
2005-12-12 20:20     ` Greg KH
2005-12-12 20:30       ` Jesper Juhl
2005-12-12 22:48   ` Alan Cox
2005-12-13  8:03     ` Arjan van de Ven
2005-12-13 14:32     ` Ashutosh Naik
2005-12-12 22:01 ` Rusty Russell
2005-12-13 14:26   ` Ashutosh Naik
2005-12-13 15:28     ` Ashutosh Naik
2005-12-13 16:49     ` [RFC][PATCH] " Jesper Juhl
2005-12-14  2:03       ` Rusty Russell
2005-12-14  4:10         ` Ashutosh Naik
2005-12-14  5:02           ` Ashutosh Naik
2005-12-15  4:40             ` Andrew Morton
2005-12-15  5:15               ` Rusty Russell
2005-12-15  5:45                 ` Ashutosh Naik
2005-12-14  5:46         ` Ashutosh Naik
2005-12-14 23:02           ` Rusty Russell

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=20051213082350.11599.qmail@web8605.mail.in.yahoo.com \
    --to=anandhkrishnan@yahoo.co.in \
    --cc=akpm@osdl.org \
    --cc=ashutosh.naik@gmail.com \
    --cc=greg@kroah.com \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rth@redhat.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 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).