NAME
pinsyscall
—
specify the call stub for a specific
system call
SYNOPSIS
#include
<sys/types.h>
#include <sys/syscall.h>
int
pinsyscall
(int
syscall, void
*start, size_t
len);
DESCRIPTION
The
pinsyscall
()
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 ld.so 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
.
RETURN VALUES
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.
ERRORS
pinsyscall
() will fail if:
- [
EINVAL
] - Unsupported syscall.
- [
EFAULT
] - The range between start and start + len is not in the address space.
- [
EPERM
] - The range for the specified syscall has been previously set.
HISTORY
The pinsyscall
() system call first
appeared in OpenBSD 7.3.