Re: [PATCH] Fix some kallsyms_lookup() vs rmmod races



Alexey Dobriyan wrote:
[cc'ing folks whose proc files are affected]

kallsyms_lookup() can call module_address_lookup() which iterates over
modules list without module_mutex taken. Comment at the top of
module_address_lookup() says it's for oops resolution so races are
irrelevant, but in some cases it's reachable from regular code:

So maybe we should just add a new parameter to "kallsyms_lookup" to inform it if it is safe to take a mutex or not.

Spreading module_mutex everywhere doesn't seem like the right interface for several reasons:

- new users of "kallsyms_lookup" might not be aware that they should take module_mutex if it is safe

- many times we will be taking module_mutex even when we are fetching a kernel symbol that shouldn't require the mutex at all

- it just creates new dependencies (hint: this patch shouldn't even compile with current git since module_mutex is not declared in module.h, not to mention compile when CONFIG_MODULES not set)

IMHO we should not expose module_mutex outside of module.c. That is just wrong from an encapsulation point of view.

--
Paulo Marques - www.grupopie.com

"667: The neighbor of the beast."

-
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/



Relevant Pages

  • Re: Issues with multiple instances
    ... definitely a safe workaround. ... I have implemented a named mutex as suggested in one of the earlier ... iSplashForm = new SABannerForm; ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: The various levels of /CLI
    ... program doesn't compile as in '/CLI safe', ... CLI / Safe means that the resulting program is pure managed (only ... IL instructions, and no native CPU instructions), which is the same as CLI ... and VB) produce verifiable code by default or even exclusively. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: HardBound and SoftBound (was "The State of Software")
    ... lots of these nice safe libraries call libraries written in ... if "new code" is self consistent and safe, ... cell phones would lead to safe Java taking over the world. ... languages) compilers that compile through C, ...
    (comp.arch)
  • Re: [PATCH] Fix some kallsyms_lookup() vs rmmod races
    ... inform it if it is safe to take a mutex or not. ... This patch is techically dependent on http://lkml.org/lkml/2007/3/14/128 aka ...
    (Linux-Kernel)
  • Re: Is iostream/fstream thread safe ?
    ... running is a safe mode regarding usage of iostream. ... ".....To perform a sequence of operations on an iostream class object ... But you need to compile and link your application with -mt option. ... > multithread safe but are not async safe. ...
    (comp.unix.solaris)