PINSYSCALLS(2)

NAME
pinsyscalls - pin system call entry to precise locations in the address space

SYNOPSIS
#include <sys/types.h>
int
pinsyscalls(void *start, size_t len, uint *pintable, size_t pintablesize);

DESCRIPTION
The pinsyscalls() system call specifies the start to start + len range in the address space where the system call entry instructions are found, and furthermore provides a table of uint offsets from that start (indexed by the system call number) to provide the precise location for the system call instruction required for that system call number.

pinsyscalls() is only called by the shared library linker ld.so(1) to tell the kernel where system calls are found in the dynamic library libc.so (the filename is actually /usr/lib/libc.so.major.minor).

A similar setup operation is done automatically by the kernel for the system calls found in ld.so(1) and in static executables.

Once the kernel knows the specific location in the address space where a specific system call must be entered from, any attempt to use a different system call entry instruction to perform a non-corresponding system call operation will fail with signal SIGABRT.

RETURN VALUES

ERRORS
pinsyscalls() will fail if:

[EINVAL]
    Process already has a system call pinning table loaded.

[EPERM]
    A static binary tried to call pinsyscalls().

[ERANGE]
    At least one system call offset is out of bounds.

HISTORY
The pinsyscalls() system call first appeared in OpenBSD 7.4.