Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 31764
b: refs/heads/master
c: 4d435f9
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Jul 3, 2006
1 parent 2c737f8 commit 2847a1a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 93e028148fce0be9787de7fb097fa4c8582b78c1
refs/heads/master: 4d435f9d8ff01ae726a2a84edb9c2457787a337e
6 changes: 6 additions & 0 deletions trunk/include/linux/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ static inline int module_is_live(struct module *mod)
/* Is this address in a module? (second is with no locks, for oops) */
struct module *module_text_address(unsigned long addr);
struct module *__module_text_address(unsigned long addr);
int is_module_address(unsigned long addr);

/* Returns module and fills in value, defined and namebuf, or NULL if
symnum out of range. */
Expand Down Expand Up @@ -496,6 +497,11 @@ static inline struct module *__module_text_address(unsigned long addr)
return NULL;
}

static inline int is_module_address(unsigned long addr)
{
return 0;
}

/* Get/put a kernel symbol (calls should be symmetric) */
#define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); })
#define symbol_put(x) do { } while(0)
Expand Down
23 changes: 23 additions & 0 deletions trunk/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -2159,6 +2159,29 @@ const struct exception_table_entry *search_module_extables(unsigned long addr)
return e;
}

/*
* Is this a valid module address?
*/
int is_module_address(unsigned long addr)
{
unsigned long flags;
struct module *mod;

spin_lock_irqsave(&modlist_lock, flags);

list_for_each_entry(mod, &modules, list) {
if (within(addr, mod->module_core, mod->core_size)) {
spin_unlock_irqrestore(&modlist_lock, flags);
return 1;
}
}

spin_unlock_irqrestore(&modlist_lock, flags);

return 0;
}


/* Is this a valid kernel address? We don't grab the lock: we are oopsing. */
struct module *__module_text_address(unsigned long addr)
{
Expand Down

0 comments on commit 2847a1a

Please sign in to comment.