lkml.org 
[lkml]   [2007]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: /proc/kallsyms race vs module unload
Alexey Dobriyan wrote:
> [...]
> What happens is that module_get_kallsym() drops module_mutex,
> returns "struct module *", module unloaded, "struct module *"
> used.

The only use for the "struct module *" is to display the name of the
module.

This can be solved by adding a "char mod_name[MODULE_NAME_LEN];" field
to "kallsym_iter" and copy the name of the module over, while still
holding module_mutex. It would be slightly slower, but safer.

We can even change the function's interface, so that it doesn't return a
"struct module *" at all, since AFAICS kallsyms is the only user of that
function.

It will still produce strange artifacts, though. If the iterator is
already past the removed module symbols, it will skip as many symbols as
the module symbol count, failing to show some symbols from unrelated
modules. It won't oops, though.

I'll try to cook up a patch, if no one objects to this approach,

--
Paulo Marques - www.grupopie.com

"There cannot be a crisis today; my schedule is already full."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-03-13 19:53    [W:0.034 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site