Restrict System Calls with Systrace
Keep your programs from performing tasks they weren’t meant to do.
One of the more
exciting new
features in NetBSD and OpenBSD is systrace, a
system call access manager. With systrace, a
system administrator can specify which programs can make which system
calls, and how those calls can be made. Proper use of
systrace can greatly reduce the risks inherent
in running poorly written or exploitable programs. Systrace
policies can confine users in a manner completely
independent of Unix permissions. You can even define the errors that
the system calls return when access is denied, to allow programs to
fail in a more proper manner. Proper use of systrace
requires a practical understanding of system calls and
what functionality programs must have to work properly.
First of all, what exactly are system calls? A system call is a function that lets you talk to the operating-system kernel. If you want to allocate memory, open a TCP/IP port, or perform input/output on the disk, you’ll need to use a system call. System calls are documented in section 2 of the manpages.
Unix also supports a wide variety of C library calls. These are often confused with system calls but are actually just standardized routines for things that could be written within a program. For example, you could easily write a function to compute square roots within a program, but you could not write a function to allocate memory without using a system call. If you’re in doubt whether a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access