Skip to content

Latest commit

 

History

History
59 lines (45 loc) · 2.35 KB

File metadata and controls

59 lines (45 loc) · 2.35 KB

🐧 Linux System Call Project

This project focuses on compiling and deploying a custom Linux kernel with an added system call that prints detailed information about a process to the kernel log buffer. The work demonstrates an understanding of Linux kernel internals, system call implementation, and kernel debugging using user-level C programs.


📘 Overview

The goal of this project was to extend the Linux kernel by implementing a custom system call that provides insights into the internal state of any given process.
This system call accepts a process ID (PID) and prints key details — such as its name, state, PID, priority values, and parent process information — to the kernel log buffer.

By developing and testing this system call, the project provides hands-on experience in:

  • Modifying kernel source code
  • Rebuilding and deploying a custom Linux kernel
  • Interacting with the kernel through user-space programs

⚙️ Implementation Steps

1. Download and Set Up Linux Kernel

  • Downloaded the official Linux kernel source code (version used: 5.11.14).
  • Configured the kernel environment for building and testing.

2. Add Custom System Call

  • Implemented a new system call in the kernel source tree.
  • Modified the following files:
    • System call table
    • System call header file
    • Makefile in the relevant kernel directory
  • The system call source file was added to handle the logic for retrieving and printing process details.

3. System Call Functionality

  • The custom system call:
    • Accepts a process ID (PID) as input.
    • Retrieves the task_struct of the corresponding process.
    • Prints details including:
      • Process ID (PID)
      • Process Name
      • Process State
      • Static and Dynamic Priority
      • Parent Process ID and Name
    • Logs the output to the kernel log buffer, viewable using:
      dmesg

🧪 Testing

Test Programs

  • Developed multiple C programs to validate the functionality of the system call.
  • Used fork() to create parent-child processes and observed their states.

Expected Behavior

  • The parent process was observed in a waiting state.
  • The child process was in a running state.
  • All process details were correctly printed to the kernel log buffer.