Skip to content

This Linux kernel module provides the users with a solution to inspect both vm_area structs and page table entries of target processes.

License

Notifications You must be signed in to change notification settings

emisilve86/VM-Monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VM-Monitor

Description

This Linux kernel module provides the users with a solution to inspect both VM area structures and page table entries of target processes. It allows to perform custom checks at each level of the page table directory, such as verifying whether specific bit of PGD, P4D, PUD, PMD and PTE entries are set or not, or if their states are consistent with respect to those specified in the vm_area_struct instances they belong to.

It provides same logic of the kernel's page-walker implemented in /mm/pagewalk.c but some additional precautions not to incur the risk of having the task_struct and mm_struct of the target process freed while the walker is running, and preventing the CPU from stalling by mean of periodic calls to cond_resched immediately-after/just-before releasing/acquiring the MM's RW-semaphore.

Once a process has been identified as the target, and its PID passed to the special devive /dev/vm-monitor through the ioctl system-call, a kernel thread, specifically spawned to perform page-walking, begins its exploration thought the page table directory.

Build and Install

To build and install the kernel module, move to the module/ directory and launch the following commands

make
sudo insmod vm-monitor.ko

Test

To test the installed kernel module, move to the test/ directory and launch the following commands

make
./vmmon <SECONDS>

The vmmon test program simply forks a child representing the target process to monitor, which does nothing but call mmap and unmap multiple times, for a period of time that lasts as long as the SECONDS argument specifies.

About

This Linux kernel module provides the users with a solution to inspect both vm_area structs and page table entries of target processes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published