2 .\" Copyright (c) 2008-2009 Robert N. M. Watson
3 .\" All rights reserved.
5 .\" This software was developed at the University of Cambridge Computer
6 .\" Laboratory with support from a grant from Google, Inc.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
17 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .Nd Capability mode system calls
43 .Fn cap_getmode "u_int *modep"
46 places the current process into capability mode, a mode of execution in which
47 processes may only issue system calls operating on file descriptors or
48 reading limited global system state.
49 Access to global name spaces, such as file system or IPC name spaces, is
51 If the process is already in a capability mode sandbox, the system call is a
53 Future process descendants created with
57 will be placed in capability mode from inception.
60 .Xr cap_rights_limit 2 ,
61 .Xr cap_ioctls_limit 2 ,
62 .Xr cap_fcntls_limit 2 ,
64 may be used to create kernel-enforced sandboxes in which
65 appropriately-crafted applications or application components may be run.
68 returns a flag indicating whether or not the process is in a capability mode
73 sysctl MIB is set to a non-zero value, then for any process executing in a
74 capability mode sandbox, any syscall which results in either an
78 error also generates the synchronous
80 signal to the thread on the syscall return.
81 On signal delivery, the
85 signal handler parameter is set to the syscall error value,
94 .Dv PROC_TRAPCAP_STATUS
97 function for similar per-process functionality.
99 .Rv -std cap_enter cap_getmode
101 When the process is in capability mode,
103 sets the flag to a non-zero value.
104 A zero value means the process is not in capability mode.
114 The running kernel was compiled without
115 .Cd "options CAPABILITY_MODE" .
120 system call may also return the following error:
125 points outside the process's allocated address space.
128 .Xr cap_fcntls_limit 2 ,
129 .Xr cap_ioctls_limit 2 ,
130 .Xr cap_rights_limit 2 ,
133 .Xr cap_sandboxed 3 ,
139 system call first appeared in
141 Support for capabilities and capabilities mode was developed as part of the
145 These functions and the capability facility were created by
146 .An "Robert N. M. Watson"
147 at the University of Cambridge Computer Laboratory with support from a grant
150 Creating effective process sandboxes is a tricky process that involves
151 identifying the least possible rights required by the process and then
152 passing those rights into the process in a safe manner.
155 should also be aware of other inherited rights, such as access to VM
156 resources, memory contents, and other process properties that should be
158 It is advisable to use
160 to create a runtime environment inside the sandbox that has as few implicitly
161 acquired rights as possible.