Re: owner field in `struct fs'

From: Philipp Rumpf (prumpf@uzix.org)
Date: Sun Jun 25 2000 - 21:14:28 EST


On Mon, Jun 26, 2000 at 12:01:47PM +1000, Keith Owens wrote:
> On Sun, 25 Jun 2000 08:29:56 -0700,
> Philipp Rumpf <prumpf@uzix.org> wrote:
> >Yes. schedule() out of a zero-refcount module is a bug. In fact, it's
> >quite easy to make it a BUG() as well:
> >
> >struct module *lookup_module(unsigned long pc)
> >{
> > struct module *mod;
> >
> > for(mod = &kernel_module; mod; mod = mod->next) {
> > if((pc >= (unsigned long)mod) && (pc < (unsigned long)mod+mod->size))
> > return mod;
> > }
> >
> > return NULL;
> >}
> >
> >in schedule():
> >
> >if((mod = lookup_module(__builtin_return_address(0))) && (atomic_read(&mod->uc.usecount) == 0))
> > BUG();
>
> Won't work with module code which calls x() which calls y() which calls
> schedule(). __builtin_return_address points to y(), not the module.
> The vast majority of modules do not call schedule() directly, all the
> sleeps occur in service routines which are called from modules.

If it's really a significant issue (it was for file operations), you can
catch the relevant cases with BUG()s. I agree putting it in schedule()
itself doesn't catch any realistic problems.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jun 26 2000 - 21:00:07 EST