This post may contain affiliate links, please read our affiliate disclosure to learn more.
Loadable Kernel Modules (LKM): What Are They Used For?

Loadable Kernel Modules (LKM): What Are They Used For?

Author
 By Charles Joseph | Cybersecurity Researcher
Clock
 Published on December 15th, 2023

Loadable Kernel Modules (LKM) are objects that can be inserted into or removed from the kernel of an operating system on the fly. They have complete access to the kernel’s inner workings, allowing for the addition of features or extension of functionality without the need to reboot the system.

Loadable Kernel Modules (LKM) Examples

1. Device Drivers

The first and often the most common use of Loadable Kernel Modules is device drivers. The modular nature of LKMs allows for this flexibility. Imagine an instance where a new piece of hardware, maybe a printer, gets added to the system. To interact with this newly added hardware, the system needs a driver.

NordVPN 67% off + 3-month VPN coupon

Stay One Step Ahead of Cyber Threats

Want to Be the Smartest Guy in the Room? Get the Latest Cybersecurity News and Insights.
We respect your privacy and you can unsubscribe anytime.

Instead of rebooting the entire system to load this driver onto the kernel, an LKM containing the necessary driver can be dynamically loaded. By simply executing the new module, the system is enabled to interact with the new hardware or device, ensuring smooth integration and functionality. It saves time and provides efficient hardware management without disruption to the system operations.

The same procedure applies when the device is no longer needed. The respective LKM can be efficiently unloaded from the system, freeing up resources. Device drivers, therefore, serve as a fundamental example of how Loadable Kernel Modules can be utilized for expanding system capabilities.

2. Filesystem Support

Another key use of Loadable Kernel Modules is in supporting various filesystems. Operating systems need to handle a variety of filesystem types to cater to varying user needs. However, not all are included by default in the primary kernel given the diversity of filesystems available and the space they would take-up.

Suppose a user needs to read files stored in a rare or novel filesystem not supported by the standard kernel. In such a situation, instead of altering the core kernel, the user can simply load an LKM that carries the necessary filesystem support. For example, a user using a Linux system might need to access files stored on a USB formatted with the NTFS filesystem, which Linux doesn’t support natively. To overcome this hurdle, the user can load an NTFS LKM, which would let their Linux system read and write to the NTFS-formatted USB.

Once the user has finished using the filesystem, the LKM can be unloaded to free up system resources. This flexibility allows the users to customize their system’s capabilities on an as-needed basis, which makes LKMs highly useful for supporting various filesystems.

3. Network Protocols

The third common use of Loadable Kernel Modules is in enabling and extending support for new or non-standard network protocols. As technology advances and networking needs evolve, new protocols might be introduced or come into popularity.

For example, a tech company may create a new networking protocol specifically designed for its devices or technologies. To use this protocol on existing systems, a dynamic update without halting the entire system becomes necessary. Here, an LKM can be used. The required protocol can be incorporated into an LKM and loaded dynamically into the system. This will enable the system to support the new protocol without requiring a complete reboot.

Similarly, if a user no longer needs the additional protocol, the LKM carrying it can be unloaded to free system resources. This approach provides a significant advantage, especially in large systems, where reboots can result in a considerable loss of uptime. Accordingly, the use of LKMs for adding network protocol support is a vital example of the modules’ utility and versatility.

Conclusion

In a nutshell, Loadable Kernel Modules play a critical role in expanding the capabilities of a system dynamically, without the need for a complete reboot. From managing device drivers to supporting novel filesystems or introducing new network protocols, LKMs enable systems to maintain flexibility and adaptability in the ever-evolving world of technology.

Key Takeaways

  • Loadable Kernel Modules (LKMs) are units that can be dynamically loaded and unloaded to/from the kernel of an operating system.
  • LKMs allow for the addition of features or expansion of system capabilities without needing a complete system reboot.
  • Common examples of LKM use include device drivers, filesystem support, and network protocol introduction.
  • Through LKMs, systems can handle new hardware, read various filesystems, and accommodate novel network protocols efficiently.
  • LKMs enhance system flexibility and adaptability, making them vital in the fast-paced technological world.

Related Questions

1. Can LKM loading lead to system damage?

Incorrectly created or malicious LKMs can indeed cause system damage or compromise security. But when handled properly, LKMs add functionality without causing harm.

2. Is it necessary to unload an LKM when it’s not in use?

While not strictly necessary, unloading LKMs when not in use is a good practice to free up system resources and maintain optimum system performance.

3. Can LKMs be used in all operating systems?

No, LKMs are largely a feature of Unix-like systems, such as Linux and FreeBSD. Windows employs a similar but not identical methodology.

4. Can multiple LKMs be loaded at the same time?

Yes, multiple LKMs can be loaded concurrently, enabling the system to support various new features or functionalities simultaneously.

5. Who can load or unload LKMs?

Typically, only users with administrator or root-level privileges can load or unload LKMs, ensuring system security and stability.

QUOTE:
"Amateurs hack systems, professionals hack people."
-- Bruce Schneier, a renown computer security professional
Scroll to Top