Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
module.c File Reference
#include <linux/export.h>
#include <linux/moduleloader.h>
#include <linux/ftrace_event.h>
#include <linux/init.h>
#include <linux/kallsyms.h>
#include <linux/fs.h>
#include <linux/sysfs.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/elf.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/syscalls.h>
#include <linux/fcntl.h>
#include <linux/rcupdate.h>
#include <linux/capability.h>
#include <linux/cpu.h>
#include <linux/moduleparam.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/vermagic.h>
#include <linux/notifier.h>
#include <linux/sched.h>
#include <linux/stop_machine.h>
#include <linux/device.h>
#include <linux/string.h>
#include <linux/mutex.h>
#include <linux/rculist.h>
#include <asm/uaccess.h>
#include <asm/cacheflush.h>
#include <asm/mmu_context.h>
#include <linux/license.h>
#include <asm/sections.h>
#include <linux/tracepoint.h>
#include <linux/ftrace.h>
#include <linux/async.h>
#include <linux/percpu.h>
#include <linux/kmemleak.h>
#include <linux/jump_label.h>
#include <linux/pfn.h>
#include <linux/bsearch.h>
#include <linux/fips.h>
#include "module-internal.h"
#include <trace/events/module.h>

Go to the source code of this file.

Data Structures

struct  load_info
 
struct  find_symbol_arg
 

Macros

#define CREATE_TRACE_POINTS
 
#define ARCH_SHF_SMALL   0
 
#define debug_align(X)   (X)
 
#define MOD_NUMBER_OF_PAGES(BASE, SIZE)
 
#define INIT_OFFSET_MASK   (1UL << (BITS_PER_LONG-1))
 
#define symversion(base, idx)   NULL
 
#define MODINFO_ATTR(field)
 

Functions

 DEFINE_MUTEX (module_mutex)
 
 EXPORT_SYMBOL_GPL (module_mutex)
 
 core_param (nomodule, modules_disabled, bint, 0)
 
int register_module_notifier (struct notifier_block *nb)
 
 EXPORT_SYMBOL (register_module_notifier)
 
int unregister_module_notifier (struct notifier_block *nb)
 
 EXPORT_SYMBOL (unregister_module_notifier)
 
void __module_put_and_exit (struct module *mod, long code)
 
 EXPORT_SYMBOL (__module_put_and_exit)
 
bool each_symbol_section (bool(*fn)(const struct symsearch *arr, struct module *owner, void *data), void *data)
 
 EXPORT_SYMBOL_GPL (each_symbol_section)
 
struct kernel_symbolfind_symbol (const char *name, struct module **owner, const unsigned long **crc, bool gplok, bool warn)
 
 EXPORT_SYMBOL_GPL (find_symbol)
 
struct modulefind_module (const char *name)
 
 EXPORT_SYMBOL_GPL (find_module)
 
bool is_module_percpu_address (unsigned long addr)
 
 MODINFO_ATTR (version)
 
 MODINFO_ATTR (srcversion)
 
int ref_module (struct module *a, struct module *b)
 
 EXPORT_SYMBOL_GPL (ref_module)
 
void __weak module_free (struct module *mod, void *module_region)
 
void __weak module_arch_cleanup (struct module *mod)
 
void__symbol_get (const char *symbol)
 
 EXPORT_SYMBOL_GPL (__symbol_get)
 
unsigned int __weak arch_mod_section_prepend (struct module *mod, unsigned int section)
 
void *__weak module_alloc (unsigned long size)
 
int __weak module_frob_arch_sections (Elf_Ehdr *hdr, Elf_Shdr *sechdrs, char *secstrings, struct module *mod)
 
int __weak module_finalize (const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, struct module *me)
 
 SYSCALL_DEFINE3 (init_module, void __user *, umod, unsigned long, len, const char __user *, uargs)
 
struct exception_table_entrysearch_module_extables (unsigned long addr)
 
bool is_module_address (unsigned long addr)
 
struct module__module_address (unsigned long addr)
 
 EXPORT_SYMBOL_GPL (__module_address)
 
bool is_module_text_address (unsigned long addr)
 
struct module__module_text_address (unsigned long addr)
 
 EXPORT_SYMBOL_GPL (__module_text_address)
 
void print_modules (void)
 

Variables

int modules_disabled = 0
 
struct kernel_symbol __start___ksymtab []
 
struct kernel_symbol __stop___ksymtab []
 
struct kernel_symbol __start___ksymtab_gpl []
 
struct kernel_symbol __stop___ksymtab_gpl []
 
struct kernel_symbol __start___ksymtab_gpl_future []
 
struct kernel_symbol __stop___ksymtab_gpl_future []
 
const unsigned long __start___kcrctab []
 
const unsigned long __start___kcrctab_gpl []
 
const unsigned long __start___kcrctab_gpl_future []
 
struct module_attribute module_uevent
 

Macro Definition Documentation

#define ARCH_SHF_SMALL   0

Definition at line 68 of file module.c.

#define CREATE_TRACE_POINTS

Definition at line 64 of file module.c.

#define debug_align (   X)    (X)

Definition at line 79 of file module.c.

#define INIT_OFFSET_MASK   (1UL << (BITS_PER_LONG-1))

Definition at line 92 of file module.c.

#define MOD_NUMBER_OF_PAGES (   BASE,
  SIZE 
)
Value:
(((SIZE) > 0) ? \
(PFN_DOWN((unsigned long)(BASE) + (SIZE) - 1) - \
PFN_DOWN((unsigned long)BASE) + 1) \
: (0UL))

Definition at line 86 of file module.c.

#define MODINFO_ATTR (   field)
Value:
static void setup_modinfo_##field(struct module *mod, const char *s) \
{ \
mod->field = kstrdup(s, GFP_KERNEL); \
} \
static ssize_t show_modinfo_##field(struct module_attribute *mattr, \
struct module_kobject *mk, char *buffer) \
{ \
return sprintf(buffer, "%s\n", mk->mod->field); \
} \
static int modinfo_##field##_exists(struct module *mod) \
{ \
return mod->field != NULL; \
} \
static void free_modinfo_##field(struct module *mod) \
{ \
kfree(mod->field); \
mod->field = NULL; \
} \
static struct module_attribute modinfo_##field = { \
.attr = { .name = __stringify(field), .mode = 0444 }, \
.show = show_modinfo_##field, \
.setup = setup_modinfo_##field, \
.test = modinfo_##field##_exists, \
.free = free_modinfo_##field, \
};

Definition at line 576 of file module.c.

#define symversion (   base,
  idx 
)    NULL

Definition at line 268 of file module.c.

Function Documentation

struct module* __module_address ( unsigned long  addr)
read

Definition at line 3557 of file module.c.

void __module_put_and_exit ( struct module mod,
long  code 
)

Definition at line 206 of file module.c.

struct module* __module_text_address ( unsigned long  addr)
read

Definition at line 3598 of file module.c.

void* __symbol_get ( const char symbol)

Definition at line 1879 of file module.c.

unsigned int __weak arch_mod_section_prepend ( struct module mod,
unsigned int  section 
)

Definition at line 2022 of file module.c.

core_param ( nomodule  ,
modules_disabled  ,
bint  ,
 
)
DEFINE_MUTEX ( module_mutex  )
bool each_symbol_section ( bool(*)(const struct symsearch *arr, struct module *owner, void *data fn,
void data 
)

Definition at line 292 of file module.c.

EXPORT_SYMBOL ( register_module_notifier  )
EXPORT_SYMBOL ( unregister_module_notifier  )
EXPORT_SYMBOL ( __module_put_and_exit  )
EXPORT_SYMBOL_GPL ( module_mutex  )
EXPORT_SYMBOL_GPL ( each_symbol_section  )
EXPORT_SYMBOL_GPL ( find_symbol  )
EXPORT_SYMBOL_GPL ( find_module  )
EXPORT_SYMBOL_GPL ( ref_module  )
EXPORT_SYMBOL_GPL ( __symbol_get  )
EXPORT_SYMBOL_GPL ( __module_address  )
EXPORT_SYMBOL_GPL ( __module_text_address  )
struct module* find_module ( const char name)
read

Definition at line 453 of file module.c.

struct kernel_symbol* find_symbol ( const char name,
struct module **  owner,
const unsigned long **  crc,
bool  gplok,
bool  warn 
)
read

Definition at line 427 of file module.c.

bool is_module_address ( unsigned long  addr)

Definition at line 3539 of file module.c.

bool is_module_percpu_address ( unsigned long  addr)

Definition at line 569 of file module.c.

bool is_module_text_address ( unsigned long  addr)

Definition at line 3580 of file module.c.

MODINFO_ATTR ( version  )
MODINFO_ATTR ( srcversion  )
void* __weak module_alloc ( unsigned long  size)

Definition at line 2379 of file module.c.

void __weak module_arch_cleanup ( struct module mod)

Definition at line 1834 of file module.c.

int __weak module_finalize ( const Elf_Ehdr hdr,
const Elf_Shdr sechdrs,
struct module me 
)

Definition at line 2911 of file module.c.

void __weak module_free ( struct module mod,
void module_region 
)

Definition at line 1829 of file module.c.

int __weak module_frob_arch_sections ( Elf_Ehdr hdr,
Elf_Shdr sechdrs,
char secstrings,
struct module mod 
)

Definition at line 2842 of file module.c.

void print_modules ( void  )

Definition at line 3612 of file module.c.

int ref_module ( struct module a,
struct module b 
)

Definition at line 1004 of file module.c.

int register_module_notifier ( struct notifier_block nb)

Definition at line 158 of file module.c.

struct exception_table_entry* search_module_extables ( unsigned long  addr)
read

Definition at line 3509 of file module.c.

SYSCALL_DEFINE3 ( init_module  ,
void __user ,
umod  ,
unsigned  long,
len  ,
const char __user ,
uargs   
)

Definition at line 3110 of file module.c.

int unregister_module_notifier ( struct notifier_block nb)

Definition at line 164 of file module.c.

Variable Documentation

const unsigned long __start___kcrctab[]
const unsigned long __start___kcrctab_gpl[]
const unsigned long __start___kcrctab_gpl_future[]
struct kernel_symbol __start___ksymtab[]
struct kernel_symbol __start___ksymtab_gpl[]
struct kernel_symbol __start___ksymtab_gpl_future[]
struct kernel_symbol __stop___ksymtab[]
struct kernel_symbol __stop___ksymtab_gpl[]
struct kernel_symbol __stop___ksymtab_gpl_future[]
struct module_attribute module_uevent
Initial value:
=
__ATTR(uevent, 0200, NULL, store_uevent)

Definition at line 1069 of file module.c.

int modules_disabled = 0

Definition at line 146 of file module.c.