summaryrefslogtreecommitdiffstats
path: root/upstream/opensuse-tumbleweed/man2/init_module.2
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-17 10:51:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-17 10:51:52 +0000
commit4ad94864781f48b1a4b77f9cfb934622bf756ba1 (patch)
tree3900955c1886e6d2570fea7125ee1f01bafe876d /upstream/opensuse-tumbleweed/man2/init_module.2
parentAdding upstream version 4.22.0. (diff)
downloadmanpages-l10n-4ad94864781f48b1a4b77f9cfb934622bf756ba1.tar.xz
manpages-l10n-4ad94864781f48b1a4b77f9cfb934622bf756ba1.zip
Adding upstream version 4.23.0.upstream/4.23.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'upstream/opensuse-tumbleweed/man2/init_module.2')
-rw-r--r--upstream/opensuse-tumbleweed/man2/init_module.295
1 files changed, 73 insertions, 22 deletions
diff --git a/upstream/opensuse-tumbleweed/man2/init_module.2 b/upstream/opensuse-tumbleweed/man2/init_module.2
index a5fed4dd..98b3c5c9 100644
--- a/upstream/opensuse-tumbleweed/man2/init_module.2
+++ b/upstream/opensuse-tumbleweed/man2/init_module.2
@@ -4,7 +4,7 @@
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
-.TH init_module 2 2023-03-30 "Linux man-pages 6.05.01"
+.TH init_module 2 2024-05-02 "Linux man-pages (unreleased)"
.SH NAME
init_module, finit_module \- load a kernel module
.SH LIBRARY
@@ -15,14 +15,14 @@ Standard C library
.BR "#include <linux/module.h>" " /* Definition of " MODULE_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
-.PP
+.P
.BI "int syscall(SYS_init_module, void " module_image [. len "], \
unsigned long " len ,
.BI " const char *" param_values );
.BI "int syscall(SYS_finit_module, int " fd ,
.BI " const char *" param_values ", int " flags );
.fi
-.PP
+.P
.IR Note :
glibc provides no wrappers for these system calls,
necessitating the use of
@@ -36,7 +36,7 @@ and then runs the module's
.I init
function.
This system call requires privilege.
-.PP
+.P
The
.I module_image
argument points to a buffer containing the binary image
@@ -44,7 +44,7 @@ to be loaded;
.I len
specifies the size of that buffer.
The module image should be a valid ELF image, built for the running kernel.
-.PP
+.P
The
.I param_values
argument is a string containing space-delimited specifications of the
@@ -55,12 +55,12 @@ and
The kernel parses this string and initializes the specified
parameters.
Each of the parameter specifications has the form:
-.PP
+.P
.RI " " name [\c
.BI = value\c
.RB [ ,\c
.IR value ...]]
-.PP
+.P
The parameter
.I name
is one of those defined within the module using
@@ -93,7 +93,7 @@ The
.I param_values
argument is as for
.BR init_module ().
-.PP
+.P
The
.I flags
argument modifies the operation of
@@ -107,7 +107,11 @@ Ignore symbol version hashes.
.TP
.B MODULE_INIT_IGNORE_VERMAGIC
Ignore kernel version magic.
-.PP
+.TP
+.BR MODULE_INIT_COMPRESSED_FILE " (since Linux 5.17)"
+.\" commit b1ae6dc41eaaa98bb75671e0f3665bfda248c3e7
+Use in-kernel module decompression.
+.P
There are some safety checks built into a module to ensure that
it matches the kernel against which it is loaded.
.\" http://www.tldp.org/HOWTO/Module-HOWTO/basekerncompat.html
@@ -125,7 +129,7 @@ for the function named by the symbol.
In this case, the kernel version number within the
"vermagic" string is ignored,
as the symbol version hashes are assumed to be sufficiently reliable.
-.PP
+.P
Using the
.B MODULE_INIT_IGNORE_VERMAGIC
flag indicates that the "vermagic" string is to be ignored, and the
@@ -136,6 +140,40 @@ If the kernel is built to permit forced loading (i.e., configured with
then loading continues, otherwise it fails with the error
.B ENOEXEC
as expected for malformed modules.
+.P
+If the kernel was build with
+.BR CONFIG_MODULE_DECOMPRESS ,
+the in-kernel decompression feature can be used.
+User-space code can check if the kernel supports decompression
+by reading the
+.I /sys/module/compression
+attribute.
+If the kernel supports decompression,
+the compressed file can directly be passed to
+.BR finit_module ()
+using the
+.B MODULE_INIT_COMPRESSED_FILE
+flag.
+The in-kernel module decompressor supports the following compression algorithms:
+.P
+.RS 4
+.PD 0
+.IP \[bu] 3
+.I gzip
+(since Linux 5.17)
+.IP \[bu]
+.I xz
+(since Linux 5.17)
+.IP \[bu]
+.I zstd
+.\" commit 169a58ad824d896b9e291a27193342616e651b82
+(since Linux 6.2)
+.PD
+.RE
+.P
+The kernel only implements a single decompression method.
+This is selected during module generation accordingly to the compression method
+chosen in the kernel configuration.
.SH RETURN VALUE
On success, these system calls return 0.
On error, \-1 is returned and
@@ -177,7 +215,7 @@ or module loading is disabled
.I /proc/sys/kernel/modules_disabled
in
.BR proc (5)).
-.PP
+.P
The following errors may additionally occur for
.BR init_module ():
.TP
@@ -205,7 +243,7 @@ The binary image supplied in
.I module_image
is not an ELF image,
or is an ELF image that is invalid or for a different architecture.
-.PP
+.P
The following errors may additionally occur for
.BR finit_module ():
.TP
@@ -223,16 +261,29 @@ is too large.
.I flags
is invalid.
.TP
+.B EINVAL
+The decompressor sanity checks failed,
+while loading a compressed module with flag
+.B MODULE_INIT_COMPRESSED_FILE
+set.
+.TP
.B ENOEXEC
.I fd
does not refer to an open file.
.TP
+.BR EOPNOTSUPP " (since Linux 5.17)"
+The flag
+.B MODULE_INIT_COMPRESSED_FILE
+is set to load a compressed module,
+and the kernel was built without
+.BR CONFIG_MODULE_DECOMPRESS .
+.TP
.BR ETXTBSY " (since Linux 4.7)"
.\" commit 39d637af5aa7577f655c58b9e55587566c63a0af
The file referred to by
.I fd
is opened for read-write.
-.PP
+.P
In addition to the above errors, if the module's
.I init
function is executed and returns an error, then
@@ -250,7 +301,7 @@ Linux.
.TP
.BR finit_module ()
Linux 3.8.
-.PP
+.P
The
.BR init_module ()
system call is not supported by glibc.
@@ -265,11 +316,11 @@ alternatively, you can invoke the system call using
In Linux 2.4 and earlier, the
.BR init_module ()
system call was rather different:
-.PP
+.P
.B " #include <linux/module.h>"
-.PP
+.P
.BI " int init_module(const char *" name ", struct module *" image );
-.PP
+.P
(User-space applications can detect which version of
.BR init_module ()
is available by calling
@@ -277,7 +328,7 @@ is available by calling
the latter call fails with the error
.B ENOSYS
on Linux 2.6 and later.)
-.PP
+.P
The older version of the system call
loads the relocated module image pointed to by
.I image
@@ -288,11 +339,11 @@ The caller is responsible for providing the relocated image (since
Linux 2.6, the
.BR init_module ()
system call does the relocation).
-.PP
+.P
The module image begins with a module structure and is followed by
code and data as appropriate.
Since Linux 2.2, the module structure is defined as follows:
-.PP
+.P
.in +4n
.EX
struct module {
@@ -317,7 +368,7 @@ struct module {
};
.EE
.in
-.PP
+.P
All of the pointer fields, with the exception of
.I next
and
@@ -330,7 +381,7 @@ Information about currently loaded modules can be found in
.I /proc/modules
and in the file trees under the per-module subdirectories under
.IR /sys/module .
-.PP
+.P
See the Linux kernel source file
.I include/linux/module.h
for some useful background information.