.\" $OpenBSD: pinsyscalls.2,v 1.5 2024/04/01 19:29:16 benno Exp $ .\" .\" Copyright (c) 2023 Theo de Raadt .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd $Mdocdate: April 1 2024 $ .Dt PINSYSCALLS 2 .Os .Sh NAME .Nm pinsyscalls .Nd pin system call entry to precise locations in the address space .Sh SYNOPSIS .In sys/types.h .Ft int .Fn pinsyscalls "void *start" "size_t len" "u_int *pintable" "int npins" .Sh DESCRIPTION The .Fn pinsyscalls system call specifies the .Va start to .Va start + len address space range where the system call entry instructions are found, and a .Va npins Ns -sized array of u_int entries (indexed by the system call number) which are offsets from the .Va start . .Pp This provides the precise location for the system call instruction required for each system call number. Attempting to use a different system call entry instruction to perform a non-corresponding system call operation will fail with signal .Dv SIGABRT . .Pp .Fn pinsyscalls is only called by the shared library linker .Xr ld.so 1 to tell the kernel where the text / executable region containing system calls is found in the dynamic library .Pa libc.so (the filename is actually /usr/lib/libc.so.major.minor). .Pp A similar setup operation is done automatically by the kernel for the system calls found in .Xr ld.so 1 and in static executables. .Sh RETURN VALUES .Rv -std .Sh ERRORS .Fn pinsyscalls will fail if: .Bl -tag -width Er .It Bq Er E2BIG Implausible number of system calls provided. .It Bq Er ENOMEM Insufficient memory to service the request. .It Bq Er EPERM A static binary tried to call .Fn pinsyscalls , or it was called a second time. .It Bq Er ERANGE At least one system call offset is beyond the bounds of .Ar len . .El .Sh HISTORY The .Fn pinsyscalls system call first appeared in .Ox 7.5 .