diff options
author | Peter Zijlstra <peterz@infradead.org> | 2015-05-26 21:39:35 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2015-05-27 22:01:52 -0400 |
commit | 0be964be0d45084245673c971d72a4b51690231d (patch) | |
tree | c3d0f0497d325c28f344adda9c3305e75e550c60 /include/linux/module.h | |
parent | bed831f9a251968272dae10a83b512c7db256ef0 (diff) |
module: Sanitize RCU usage and locking
Currently the RCU usage in module is an inconsistent mess of RCU and
RCU-sched, this is broken for CONFIG_PREEMPT where synchronize_rcu()
does not imply synchronize_sched().
Most usage sites use preempt_{dis,en}able() which is RCU-sched, but
(most of) the modification sites use synchronize_rcu(). With the
exception of the module bug list, which actually uses RCU.
Convert everything over to RCU-sched.
Furthermore add lockdep asserts to all sites, because it's not at all
clear to me the required locking is observed, esp. on exported
functions.
Cc: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux/module.h')
-rw-r--r-- | include/linux/module.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index c883b86ea964..fb56dd85a862 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -421,14 +421,22 @@ struct symsearch { | |||
421 | bool unused; | 421 | bool unused; |
422 | }; | 422 | }; |
423 | 423 | ||
424 | /* Search for an exported symbol by name. */ | 424 | /* |
425 | * Search for an exported symbol by name. | ||
426 | * | ||
427 | * Must be called with module_mutex held or preemption disabled. | ||
428 | */ | ||
425 | const struct kernel_symbol *find_symbol(const char *name, | 429 | const struct kernel_symbol *find_symbol(const char *name, |
426 | struct module **owner, | 430 | struct module **owner, |
427 | const unsigned long **crc, | 431 | const unsigned long **crc, |
428 | bool gplok, | 432 | bool gplok, |
429 | bool warn); | 433 | bool warn); |
430 | 434 | ||
431 | /* Walk the exported symbol table */ | 435 | /* |
436 | * Walk the exported symbol table | ||
437 | * | ||
438 | * Must be called with module_mutex held or preemption disabled. | ||
439 | */ | ||
432 | bool each_symbol_section(bool (*fn)(const struct symsearch *arr, | 440 | bool each_symbol_section(bool (*fn)(const struct symsearch *arr, |
433 | struct module *owner, | 441 | struct module *owner, |
434 | void *data), void *data); | 442 | void *data), void *data); |