System Calls & the Kernel Interface Questions

The boundary between user space and the kernel: how programs request privileged services through system calls, the user/kernel mode transition, and the semantics of core POSIX calls such as fork, exec, wait, open, read, write, and stat. Covers syscall numbers, arguments, return values and errno, and how libc wrappers relate to the underlying trap. This is the foundational interface for all systems programming on Unix/Linux.

EasyTechnical
65 practiced

How do opendir(), readdir(), and closedir() work together? What information can you trust from directory enumeration, and what additional checks would you perform before acting on an entry in a security tool?

HardTechnical
54 practiced

A malware analyst tool walks a directory tree, filters for regular files, and then hashes them. How would you make the file-type checks and traversal resistant to symlink tricks, renamed paths, and concurrent filesystem changes?

MediumTechnical
104 practiced

You are building a secure file-copy routine for a forensic tool. How would you preserve metadata such as permissions and timestamps while avoiding symlink attacks, unsafe path traversal, and accidental writes outside the target directory?

HardTechnical
63 practiced

Implement a minimal ptrace-based tracer in C that attaches to a running process, intercepts execve syscalls, and logs the command-line arguments of executed programs. Provide code for attaching, using PTRACE_SYSCALL to intercept entry/exit, and reading strings from traced process memory. Discuss performance and security limitations of ptrace in production.

HardTechnical
52 practiced

Describe TOCTOU (time-of-check to time-of-use) race conditions when performing file system operations. Provide concrete examples where checking a path then opening it leads to vulnerabilities. Explain how openat(2), O_NOFOLLOW, O_DIRECTORY, and fstatat(2) can be used to avoid races and perform secure atomic checks and opens.

Unlock Full Question Bank

Get access to all 7 System Calls & the Kernel Interface interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.