OpenBSD manual page server

Manual Page Search Parameters

PINSYSCALL(2) System Calls Manual PINSYSCALL(2)

pinsyscallspecify the call stub for a specific system call

#include <sys/types.h>
#include <sys/syscall.h>

pinsyscall(int syscall, void *start, size_t len);

The () system call specifies the start to start + len range in the address space where the call stub for the specified syscall resides. This range is typically under 80 bytes long, and varies by architecture.

Only the SYS_execve system call is currently supported. The shared library linker automatically tells the kernel about SYS_execve at startup. For static binaries, libc initialization performs the same action.

Once the kernel knows the specific location in the address space where that system call must be entered from, any attempt to use a system-call entry instruction to perform the specified syscall from a different address range will deliver SIGABRT.

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

pinsyscall() will fail if:

Unsupported syscall.
The range between start and start + len is not in the address space.
The range for the specified syscall has been previously set.

The pinsyscall() system call first appeared in OpenBSD 7.3.

February 21, 2023 OpenBSD-current