Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linux Systems Programming

Three small projects that move from raw 32-bit x86 system calls, through user-space process tracing, to a Linux character-device kernel module.

Projects

1. Assembly system calls

01-assembly-syscalls is a NASM program with a custom _start entry point. It creates a directory and file, applies Unix permissions, obtains the current time through int 0x80, and writes the UTC time to the file.

cd 01-assembly-syscalls
make
cat portfolio_demo/runtime.dat
make clean

2. ptrace debugger

02-ptrace-debugger implements a compact interactive debugger for 32-bit x86 Linux programs. It supports breakpoints, sticky breakpoints, single stepping, continuing, reading and writing memory, and changing the instruction pointer.

cd 02-ptrace-debugger
make
./dbg ./target

Debugger commands:

Command Action
b ADDRESS Set a one-shot breakpoint
bs ADDRESS Set a sticky breakpoint
br Remove the breakpoint
s Step one instruction; step over a direct call
c Continue execution
p ADDRESS Print one machine word
set ADDRESS VALUE Replace one machine word
eip ADDRESS Change the instruction pointer
q Terminate the child and quit

Use nm -n target or objdump -d -M intel target to find symbol and instruction offsets. The debugger prints the PIE base address and accepts either offsets or absolute addresses.

3. Kernel character device

03-kernel-char-device creates /dev/joke. Commands written to the device manage a bounded in-kernel list of strings. The module can select, delete, and Caesar-encode entries using the Slovenian alphabet.

cd 03-kernel-char-device
make build
sudo make load

echo 'add_joke | "1234" | "Hello from kernel space"' | sudo tee /dev/joke
echo 'set_joke | 1' | sudo tee /dev/joke
cat /dev/joke

sudo make unload
make clean

Requirements

  • 32-bit x86 development support (gcc-multilib and 32-bit libc headers)
  • NASM
  • GNU Make
  • Linux kernel headers matching the running kernel

The assembly and debugger exercises intentionally target 32-bit x86. The kernel module should be built and loaded only in a disposable Linux virtual machine. Loading third-party kernel code can crash or compromise a host.

Origin

These programs were developed as university systems-programming coursework and reorganized as a self-contained portfolio collection. Generated binaries, submission archives, and instructor demonstration files are intentionally not included.

About

Linux systems programming in x86 assembly, ptrace, and a character-device kernel module.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages