Re: [PATCH v3] Race between cat /proc/kallsyms and rmmod
From: Paulo Marques
Date: Mon Mar 19 2007 - 11:21:05 EST
Alexey Dobriyan wrote:
Iterating code of /proc/kallsyms calls module_get_kallsym() which grabs
and drops module_mutex internally and returns "struct module *",
module is removed, aforementioned "struct module *" is used in non-trivial
way.
Steps to reproduce:
modprobe/rmmod loop
cat /proc/kallsyms >/dev/null loop
Copy all needed info under module_mutex.
NOTE: this patch keeps module_mutex static.
Yes, this patch fixes the "cat /proc/kallsyms" race without changing any
"external" interfaces, so I think it should go into mainline in any case.
Acked-by: Paulo Marques <pmarques@xxxxxxxxxxxx>
--
Paulo Marques - www.grupopie.com
"All I ask is a chance to prove that money can't make me happy."
-
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/