init_module.2: Add various pieces describing Linux 2.6+ behavior

Pieces take from, or inspired by, a patch sent by Kees.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Kees Cook 2012-10-09 16:37:55 +02:00 committed by Michael Kerrisk
parent 6b9024ca05
commit ce123e8e64
1 changed files with 24 additions and 7 deletions

View File

@ -6,7 +6,7 @@
.\" 2006-02-09, some reformatting by Luc Van Oostenryck; some .\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
.\" reformatting and rewordings by mtk .\" reformatting and rewordings by mtk
.\" .\"
.TH INIT_MODULE 2 2006-02-09 "Linux" "Linux Programmer's Manual" .TH INIT_MODULE 2 2012-10-09 "Linux" "Linux Programmer's Manual"
.SH NAME .SH NAME
init_module \- load a kernel module init_module \- load a kernel module
.SH SYNOPSIS .SH SYNOPSIS
@ -19,8 +19,10 @@ init_module \- load a kernel module
There is no glibc wrapper for this system call; see NOTES. There is no glibc wrapper for this system call; see NOTES.
.SH DESCRIPTION .SH DESCRIPTION
.BR init_module () .BR init_module ()
loads a kernel module, performs any necessary symbol relocations, loads an ELF image into kernel space,
and runs the module's performs any necessary symbol relocations,
initializes module parameters to values provided by the caller,
and then runs the module's
.I init .I init
function. function.
This system call requires privilege. This system call requires privilege.
@ -31,12 +33,15 @@ argument points to a buffer containing the binary image
to be loaded; to be loaded;
.I len .I len
specifies the size of that buffer. specifies the size of that buffer.
The module image should be a valid ELF image, built for the running kernel.
The The
.I param_values .I param_values
argument is a string containing space-delimited specifications of the argument is a string containing space-delimited specifications of the
values for module parameters. values for module parameters.
Each of these specifications has the form: The kernel parses this string and initializes the specified
parameters
Each of the parameter specifications has the form:
.RI " " name [ =value [ ,value ...]] .RI " " name [ =value [ ,value ...]]
@ -61,7 +66,7 @@ is set appropriately.
The module's initialization routine failed. The module's initialization routine failed.
.TP .TP
.B EEXIST .B EEXIST
A module by this name is already loaded. A module with this name is already loaded.
.TP .TP
.B EFAULT .B EFAULT
An address argument referred to an location that An address argument referred to an location that
@ -69,7 +74,9 @@ is outside the process's accessible address space.
.TP .TP
.BR EINVAL " (Linux 2.6 onward)" .BR EINVAL " (Linux 2.6 onward)"
.I param_values .I param_values
is invalid. is invalid, or some part of the ELF image in
.IR module_image
contains inconsistencies.
.TP .TP
.BR EINVAL " (Linux 2.4 and earlier)" .BR EINVAL " (Linux 2.4 and earlier)"
Some Some
@ -81,11 +88,21 @@ does not correspond to the original module name, some
entry does not correspond to a loaded module, entry does not correspond to a loaded module,
or some other similar inconsistency. or some other similar inconsistency.
.TP .TP
.B ENOEXEC
The ELF image in
.I module_image
is too small or has corrupted segments.
.TP
.B EPERM .B EPERM
The caller was not privileged The caller was not privileged
(did not have the (did not have the
.B CAP_SYS_MODULE .B CAP_SYS_MODULE
capability). capability),
or module loading is disabled
(see
.IR /proc/sys/kernel/modules_disabled
in
.BR proc (5)).
.SH "CONFORMING TO" .SH "CONFORMING TO"
.BR init_module () .BR init_module ()
is Linux-specific. is Linux-specific.