summaryrefslogtreecommitdiff
path: root/static/openbsd/man2/pinsyscalls.2
blob: a6f4679ee8e496a555d7dccc60b39404a08b02fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
.\" $OpenBSD: pinsyscalls.2,v 1.6 2025/04/06 20:20:11 kettenis Exp $
.\"
.\" Copyright (c) 2023 Theo de Raadt <deraadt@openbsd.org>
.\"
.\" 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 6 2025 $
.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).
This has to happen before additional threads are created.
.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 EPERM
Process is multi-threaded.
.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 .