Chapter 1: Introduction and Overview
Modules can also be unloaded from the kernel at run time, a useful aspect when developing new kernel
components.
Virtual file system
System Calls
ExtN
Block layer Device drivers
XFS ProcFS
Page cache Buffer cache
Applications and Libc
Various subsystems
Hard disks
Figure 1-10: Overview of how the virtual filesystem layer,
filesystem implementations, and the block layer
interoperate.
Basically, modules are simply normal programs that execute in kernel space rather than in userspace.
They must also provide certain sections that are executed when the module is initialized (and terminated)
in order to register and de-register the module functions with the kernel. Otherwise, module code has
the same rights (and obligations) as normal kernel code and can access all the same functions and data as
code that is permanently compiled into the kernel.
Modules are an essential requisite to support forhotplugging. Some buses (e.g., USB and FireWire) allow
devices to be connected while the system is runningwithout requiring a system reboot. When the sys-
tem detects a new device, the requisite driver can be automatically added to the kernel by loading the
corresponding module.
Modules also enable kernels to be built to support all kinds of devices that the kernel can address without
unnecessarily bloating kernel size. Once attached hardware has been detected, only the requisite modules
are loaded, and the kernel remains free of superfluous drivers.
A long-standing issue in the kernel community revolves around the support ofbinary-only modules,
that is, modules for which no source code is available. While binary-only modules are omnipresent
on most proprietary operating systems, many kerneldevelopers see them (at least!) as an incarnation
of the devil: Since the kernel is developed as open-source software, they believe that modules should
also be published as open source, for a variety of both legal and technical reasons. There are, indeed,
strong arguments to support this reasoning (and besides, I also follow these), but they are not shared by
some commercial companies that tend to think that opening up their driver sources would weaken their
business position.
It is currently possible to load binary-only modules into the kernel, although numerous restrictions apply
for them. Most importantly, they may not access any functions that are explicitly only made available to
GPL-licensed code. Loading a binary-only moduletaintsthe kernel, and whenever something bad occurs,
the fault is naturally attributed to the tainting module. If a kernel is tainted, this will be marked on crash
dumps, for instance, and kernel developers will be very unsupportive in solving the issue that led to
the crash — since the binary module could have given every part of the kernel a good shaking, it cannot