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
|
.\" $OpenBSD: msyscall.2,v 1.2 2019/11/27 20:53:05 schwarze Exp $
.\"
.\" Copyright (c) 2019 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: November 27 2019 $
.Dt MSYSCALL 2
.Os
.Sh NAME
.Nm msyscall
.Nd permit syscalls from a region of pages
.Sh SYNOPSIS
.In sys/mman.h
.Ft int
.Fn msyscall "void *addr" "size_t len"
.Sh DESCRIPTION
The
.Fn msyscall
system call permits system call entry from the pages that contain
the address range
.Fa addr
through
.Fa addr
\&+
.Fa len
\- 1
(inclusive).
If
.Fa len
is 0, no action is taken on the page that contains
.Fa addr .
.Pp
.Nm
is currently intended for use by
.Xr ld.so 1
only, and may be called only once to indicate the location of
the loaded
.Pa libc.so
library.
.Sh RETURN VALUES
.Rv -std
.Sh ERRORS
.Fn msyscall
will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The specified address range would wrap around.
.It Bq Er EPERM
Attempt to call
.Fn msyscall
after
.Xr ld.so 1
has called it.
.El
.Sh SEE ALSO
.Xr mmap 2
.Sh HISTORY
The
.Fn msyscall
function first appeared in
.Ox 6.7 .
|