Appendix F. Building Kernel Module for SpIDer Guard

In this section

General information

Building the kernel module

Possible build errors

General information

If the operating system does not support the fanotify mechanism used by SpIDer Guard to monitor operations on file system objects, it uses a custom loadable module (LKM) operating in kernel space.

By default, SpIDer Guard is distributed with a built kernel module for the operating systems that do not support the fanotify service. Moreover, you can build the loadable kernel module manually from the source code files distributed with SpIDer Guard in the .tar.bz2 archive.

The LKM used by SpIDer Guard is designed for Linux kernels of versions 2.6.* and later.

 

The LKM is not supported for ARM64, E2K and IBM POWER (ppc64el) architectures.

The archive with source code files is stored in the share/drweb-spider-kmod/src subdirectory of the Dr.Web Desktop Security Suite base directory (by default, /opt/drweb.com) and is named as follows: drweb-spider-kmod-<version>-<date>.tar.bz2. The drweb-spider-kmod directory also contains the check-kmod-install.sh test script. Run the script to check whether your operating system supports precompiled kernel module versions already included in Dr.Web Desktop Security Suite. If not, a message prompting to manually build the module will be displayed on the screen.

If the specified directory drweb-spider-kmod does not exist, install the drweb-spider-kmod package.

To build the LKM manually from source code, superuser (usually the root user) privileges are required. For that purpose, use the su command to switch to another user or the sudo command to build the module as another user.

Building the kernel module

1.Unpack the archive with source code to any directory. For example, the command

# tar -xf drweb-spider-kmod-<version>-<date>.tar.bz2

unpacks the source code to the directory containing the archive and creates a subdirectory with the archive file name.

Superuser privileges are required to write to the directory with the archive.

2.Navigate to the created directory with source code and run the command:

# make

If errors occur at the step of make, resolve them and restart compilation.

3.After successfully passing the make step, run the commands:

# make install
# depmod

4.After the kernel module is successfully built and registered in the system, perform additional configuration of SpIDer Guard. Specify the mode in which the component operates with the kernel module by running the command:

# drweb-ctl cfset LinuxSpider.Mode LKM

It is also possible to specify AUTO instead of LKM. In this case, SpIDer Guard will attempt to use both the kernel module and the fanotify system mechanism. For details, run the command:

$ man 1 drweb-spider

Possible build errors

Upon running the make command, errors may occur. In that event, check the following:

To ensure successful building of the module, the Perl interpreter and the GCC compiler are required. If they are absent in the system, install them.

On certain OSes, you may need to install the kernel-devel package in advance.

On certain OSes, the procedure can fail because the path to the directory with kernel source code files was specified incorrectly. In that event, use the make command with the KDIR=<path to kernel source code> parameter. Typically, the source code files are stored in the /usr/src/kernels/<kernel version> directory.

The kernel version returned by the uname -r command can differ from the <kernel version> directory name.