Home

Kernmodule

A Kernmodule, or kernel module, is a piece of code that can be loaded into an operating system's kernel to extend its functionality without rebooting. Kernel modules run in kernel space and have direct access to hardware and core kernel services, making them powerful but also potential sources of instability or security risk if not well designed.

Loading and unloading: In Linux, modules are loaded with tools such as insmod or modprobe and can

Structure and metadata: A module provides initialization and cleanup functions, registered via module_init and module_exit. Macros

Uses and limitations: Common kernel modules include device drivers, new filesystems, or networking protocols. They enable

Development and safety: Kernel developers build modules against kernel headers for the target kernel version. Testing

be
removed
with
rmmod.
The
system
keeps
track
of
loaded
modules,
and
dependencies
between
modules
are
resolved
by
modprobe
using
information
from
the
kernel's
module
directory,
typically
under
/lib/modules/$(uname
-r)/kernel.
The
command
lsmod
shows
loaded
modules,
and
modinfo
displays
metadata.
such
as
MODULE_LICENSE,
MODULE_AUTHOR,
and
MODULE_DESCRIPTION
embed
metadata.
Modules
may
export
symbols
with
EXPORT_SYMBOL
to
be
used
by
other
modules.
They
compile
into
a
file
with
.ko
extension
and
are
loaded
by
the
kernel
at
runtime.
features
without
rebooting,
but
loaded
code
runs
with
kernel
privileges
and
must
maintain
compatibility
with
the
running
kernel;
mismatches
can
cause
crashes
or
taint
the
kernel.
Licensing,
particularly
GPL-compatible
licenses,
affects
compatibility
with
some
kernel
features.
in
controlled
environments
is
essential.
Tools
such
as
modinfo,
lsmod,
and
dmesg
help
diagnose
issues
and
verify
stable
operation.