Skip to content

Latest commit

 

History

History
executable file
·
127 lines (69 loc) · 3.24 KB

028-Linux-syscalls.md

File metadata and controls

executable file
·
127 lines (69 loc) · 3.24 KB

Linux Syscalls

Linux Kernel

The Linux kernel is the core component of the Linux operating system, serving as the interface between hardware and user-level applications. It is responsible for managing system resources, providing services to user processes, and facilitating communication between software and hardware components.

A more detailed diagram:

Applications that can ran in the User Space:

  • C
  • Java
  • Python
  • Ruby

Applications that can be ran in the Kernel Space:

  • Kernel Code
  • Kernel Extensions
  • Device Drivers

System Calls

System calls provide a way for applications to interact with the kernel of an operating system.

In Linux, applications request services from the kernel by making system calls. These calls are the interface between user space and kernel space, allowing user-level processes to request the kernel's assistance in performing tasks that require higher privileges or access to protected resources.

Tracing Syscalls

To trace the syscalls sent by an application and the responses:

strace <command>

Example:

List Syscall Summary

Tracing syscalls made by a running process

As an example, we can find the syscalls made by the etcd process.

First, find the PID of the process

pidof etcd  

Then use strace:

strace -p <PID-number> 

Tracing Syscalls using AquaSec Tracee

Tracee is an open-source runtime security and forensics tool developed by Aqua Security. It helps you understand how your system and applications behave.

It is using eBPF technology to tap into your system and expose that information as events that you can consume. Events range from factual system activity events to sophisticated security events that detect suspicious behavioral patterns.

Link: Official Github Repo

It can be installed directly to the server, or it can also be ran as a Docker container. Some pre-requisites are to bind mount the following directory to the container.

Examples:

Tracing syscalls made by the ls command:

List syscalls generated by new processes:

List syscalls generated by new containers:


Back to first page