aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-07-03 03:24:24 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-03 18:27:00 -0400
commit4d435f9d8ff01ae726a2a84edb9c2457787a337e (patch)
treec4c65b739187731e89893cd10faf270067c81a56
parent93e028148fce0be9787de7fb097fa4c8582b78c1 (diff)
[PATCH] lockdep: add is_module_address()
Add is_module_address() method - to be used by lockdep. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--include/linux/module.h6
-rw-r--r--kernel/module.c23
2 files changed, 29 insertions, 0 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index 9e9dc7c24d95..d06c74fb8c26 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -358,6 +358,7 @@ static inline int module_is_live(struct module *mod)
358/* Is this address in a module? (second is with no locks, for oops) */ 358/* Is this address in a module? (second is with no locks, for oops) */
359struct module *module_text_address(unsigned long addr); 359struct module *module_text_address(unsigned long addr);
360struct module *__module_text_address(unsigned long addr); 360struct module *__module_text_address(unsigned long addr);
361int is_module_address(unsigned long addr);
361 362
362/* Returns module and fills in value, defined and namebuf, or NULL if 363/* Returns module and fills in value, defined and namebuf, or NULL if
363 symnum out of range. */ 364 symnum out of range. */
@@ -496,6 +497,11 @@ static inline struct module *__module_text_address(unsigned long addr)
496 return NULL; 497 return NULL;
497} 498}
498 499
500static inline int is_module_address(unsigned long addr)
501{
502 return 0;
503}
504
499/* Get/put a kernel symbol (calls should be symmetric) */ 505/* Get/put a kernel symbol (calls should be symmetric) */
500#define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); }) 506#define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); })
501#define symbol_put(x) do { } while(0) 507#define symbol_put(x) do { } while(0)
diff --git a/kernel/module.c b/kernel/module.c
index 281172f01e9a..0351625767b1 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2159,6 +2159,29 @@ const struct exception_table_entry *search_module_extables(unsigned long addr)
2159 return e; 2159 return e;
2160} 2160}
2161 2161
2162/*
2163 * Is this a valid module address?
2164 */
2165int is_module_address(unsigned long addr)
2166{
2167 unsigned long flags;
2168 struct module *mod;
2169
2170 spin_lock_irqsave(&modlist_lock, flags);
2171
2172 list_for_each_entry(mod, &modules, list) {
2173 if (within(addr, mod->module_core, mod->core_size)) {
2174 spin_unlock_irqrestore(&modlist_lock, flags);
2175 return 1;
2176 }
2177 }
2178
2179 spin_unlock_irqrestore(&modlist_lock, flags);
2180
2181 return 0;
2182}
2183
2184
2162/* Is this a valid kernel address? We don't grab the lock: we are oopsing. */ 2185/* Is this a valid kernel address? We don't grab the lock: we are oopsing. */
2163struct module *__module_text_address(unsigned long addr) 2186struct module *__module_text_address(unsigned long addr)
2164{ 2187{