Re: owner field in `struct fs'

From: Keith Owens (kaos@ocs.com.au)
Date: Sun Jun 25 2000 - 21:01:47 EST


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.

Don't even think of running the kernel stack to see if any return
address is inside a module. I just did this for kdb and it is fragile
as hell - tolerable for a manual debugger but not for code that is
called all the time.

-
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