1INIT_MODULE(2)             Linux Programmer's Manual            INIT_MODULE(2)
2
3
4

NAME

6       init_module, finit_module - load a kernel module
7

SYNOPSIS

9       int init_module(void *module_image, unsigned long len,
10                       const char *param_values);
11
12       int finit_module(int fd, const char *param_values,
13                        int flags);
14
15       Note: glibc provides no header file declaration of init_module() and no
16       wrapper function for finit_module(); see NOTES.
17

DESCRIPTION

19       init_module() loads an ELF image into kernel space, performs any neces‐
20       sary  symbol  relocations, initializes module parameters to values pro‐
21       vided by the caller, and then runs the module's  init  function.   This
22       system call requires privilege.
23
24       The  module_image  argument  points  to  a buffer containing the binary
25       image to be loaded; len specifies the size of that buffer.  The  module
26       image should be a valid ELF image, built for the running kernel.
27
28       The param_values argument is a string containing space-delimited speci‐
29       fications of the values for module parameters (defined inside the  mod‐
30       ule  using module_param() and module_param_array()).  The kernel parses
31       this string and initializes the  specified  parameters.   Each  of  the
32       parameter specifications has the form:
33
34               name[=value[,value...]]
35
36       The parameter name is one of those defined within the module using mod‐
37       ule_param()  (see  the  Linux  kernel  source  file  include/linux/mod‐
38       uleparam.h).   The  parameter value is optional in the case of bool and
39       invbool parameters.  Values for array parameters  are  specified  as  a
40       comma-separated list.
41
42   finit_module()
43       The  finit_module()  system  call  is like init_module(), but reads the
44       module to be loaded from the file descriptor fd.  It is useful when the
45       authenticity  of a kernel module can be determined from its location in
46       the filesystem; in cases where that is possible, the overhead of  using
47       cryptographically  signed  modules  to  determine the authenticity of a
48       module can be avoided.  The param_values argument is as  for  init_mod‐
49       ule().
50
51       The  flags  argument modifies the operation of finit_module().  It is a
52       bit mask value created by ORing together zero or more of the  following
53       flags:
54
55       MODULE_INIT_IGNORE_MODVERSIONS
56              Ignore symbol version hashes.
57
58       MODULE_INIT_IGNORE_VERMAGIC
59              Ignore kernel version magic.
60
61       There  are  some  safety  checks  built into a module to ensure that it
62       matches the kernel against  which  it  is  loaded.   These  checks  are
63       recorded  when  the  module  is  built  and verified when the module is
64       loaded.  First, the module records a "vermagic" string  containing  the
65       kernel  version  number  and prominent features (such as the CPU type).
66       Second, if the module was built with the CONFIG_MODVERSIONS  configura‐
67       tion  option