Re: /proc/kallsyms race vs module unload
From: Paulo Marques
Date: Tue Mar 13 2007 - 14:50:16 EST
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/