+ All Categories
Home > Documents > The Linux Kernel

The Linux Kernel

Date post: 03-Jan-2016
Category:
Upload: savannah-gomez
View: 123 times
Download: 13 times
Share this document with a friend
Description:
the linux kernel and its various features. The Linux Kernel. The kernel. kernels. kernels are typically classified in one of two categories: monolithic all inclusive large faster modular small core additional modules activated dynamically slower. why configure the kernel. - PowerPoint PPT Presentation
Popular Tags:
29
The Linux Kernel the linux kernel and its various features
Transcript
Page 1: The Linux Kernel

The Linux Kernel

the linux kernel

and

its various features

Page 2: The Linux Kernel

The kernel

Page 3: The Linux Kernel

kernels

• kernels are typically classified in one of two categories:– monolithic

• all inclusive

• large

• faster

– modular• small core

• additional modules activated dynamically

• slower

Page 4: The Linux Kernel
Page 5: The Linux Kernel
Page 6: The Linux Kernel
Page 7: The Linux Kernel

why configure the kernel

• Enhance system performance

• Increase security

• Increase flexibility

• Increase reliability

• Add support for new type of devices

• Remove overhead

Page 8: The Linux Kernel

four basic methods to customize

• Modify tunable kernel configuration parameters

• Building from scratch (source code)

• Loading new drivers and modules into an existing kernel on the fly

• Providing operational directives and modules into an existing kernel on the fly

Page 9: The Linux Kernel

tuning kernel parameters

• Kernel - one size doesn’t fit all• Special hook parameters allow kernel

adjustments• Special files in /proc/sys let you view and

set kernel options at run time• sysctl command is permanent way to

modify parameters. /etc/sysctl.conf read at boot time and set custom parameters values

Page 10: The Linux Kernel

sysctl examples

• sysctl net.ipv4.ip_forward=0 – turns off ipforwarding

• autoeject

• file-max default 4096

• ctrl-alt-del

• icmp_echo_ignore_all

Page 11: The Linux Kernel

adding device driver

• A device driver is a program that manages the system’s interaction with a piece of hardware. The driver layer keeps Linux device independent

• One of three forms– A patch against kernel version

– A loadable module

– Installation script or package to install patch

– #cd path_to_kernal_src

– #patch –p1 < patch_file

Page 12: The Linux Kernel

loadable kernel modules LKM

• linux commands:– lsmod list active modules– insmod <module> insert/load module– rmmod <module> remove/delete module– modprobe newer replaces above –l –i -

r

– depmod -a update module dependencies

Page 13: The Linux Kernel

linux kernel

• linux kernel is often named “vmlinuz”• linux kernel is usually found

– either in directory /boot– or in directory /

• modules found in directory /lib/modules

Page 14: The Linux Kernel

linux kernel

• compiling the linux 2.6 kernel– greatly simplified from previous kernel versions– does require considerable knowledge

regarding system hardware and its configuration

– certainly a “leap of faith”, especially the first time

Page 15: The Linux Kernel

building a kernel - outline

• Download kernel source• Uncompress to kernel source /usr/src• Config options via make menuconfig, make

xconfig, make gconfig• Compile steps: run make clean• Run make• Run make modules_install• Copy install files to /boot/vmlinuz• Edit boot loader /etc/lilo or boot/grub/grub.config

add config line for new kernel

Page 16: The Linux Kernel

linux kernel

• obtaining the source code– linux kernel archive– www.kernel.org

• source code is transferred to – directory /usr/src/linux-2.6.x.x– /usr/src/linux is symbolic link to the most

current kernel source tree

Page 17: The Linux Kernel

compiling the linux kernel

• must be root user

• must be in directory /usr/src/linux

• first step: configuration– make config– make menuconfig– make xconfig– make gconfig

• generates a configuration file .config

• recommend saving a second copy– e.g., second_config

Page 18: The Linux Kernel

compiling the linux kernel

• second step: compilation– make– make modules_install

• both of these steps can be quite time consuming!

• third step: installation– cp System.map /boot/System.map-2.6.x– cp .config /boot/config-2.6.x– cp arch/i386/boot/bzImage /boot/kernel-2.6.x

• final step: boot loader update– edit either /etc/lilo.conf or /boot/grub/grub.conf

Page 19: The Linux Kernel

loadable kernel modules

• not part of original linux design

• part of a natural evolution in the operating system– device drivers have always been modular in

nature

• loadable kernel modules (LKMs)– save memory– faster to debug and maintain– slower, only if necessary to reload into memory

Page 20: The Linux Kernel

loadable kernel modules

• Without loadable kernel modules, an operating system would have to have all possible anticipated functionality already compiled directly into the base kernel. Much of that functionality would reside in memory without being used, wasting memory, and would require that users rebuild and reboot the base kernel every time new functionality is desired. Most operating systems supporting loadable kernel modules will include modules to support most desired functionality.

Page 21: The Linux Kernel

There are six main things LKMs are used for:

• Device drivers. • Filesystem drivers. • System calls. • Network drivers. • TTY line disciplines • Executable interpreters.

• For more info: http://tldp.org/HOWTO/Module-HOWTO/x197.html

Page 22: The Linux Kernel

• LKMs are typically used to add support for new hardware and/or filesystems, or for adding system calls.

• When the functionality provided by an LKM is no longer required, it can be unloaded in order to free memory

loadable kernel modules

Page 23: The Linux Kernel

loadable kernel modules

• module operation– may be totally transparent to the user– may display its presence as a virtual file in the

directory /proc

Page 24: The Linux Kernel

loadable kernel modules

• LKMs provide a great deal of power to system programmers– quick prototyping– quick patches for bugs

• but LKMs also provide a foothold for crackers– can trojan important modules– many rootkits make use of LKMs

Page 25: The Linux Kernel

attacking LKMs

• LKMs can be trojaned– less popular than more traditional attacks on

external commands– requires compilation on the host (requires root)

• compile

• rmmod <module>

• insmod <trojan_module>

– cracker software:• knark

• adore

• rkit

Page 26: The Linux Kernel

attacking LKMs

• countermeasures:– kernel 2.6 now includes the configuration

option to disable the ability to unload a module!– monitor files in /lib/modules– make these files immutable

Page 27: The Linux Kernel

attacking the linux kernel

• significantly more complicated than attacking LKMs

• but also significantly more devastating– must modify the kernel source tree– must reconfigure and recompile a kernel– must reboot the system

• this is usually quite noticeable!!!

Page 28: The Linux Kernel

strengthening the kernel

• Openwall Project Linux Security Patch– Security enhanced os & utilities– www.openwall.com

• LIDS: Linux Intrusion Detection System– additional security features added to kernel– www.lids.org

Page 29: The Linux Kernel

hardening the kernel

• grsecurity –kernel security patches

• SE-Linux security enhanced Linux

• LCAP Linux Kernel Capability Remover

• systrace - enforces system call policies for applications

• lsm Linux security modules


Recommended