2 .\" Copyright (c) 2008-2010 Robert N. M. Watson
3 .\" Copyright (c) 2012-2013 The FreeBSD Foundation
4 .\" All rights reserved.
6 .\" This software was developed at the University of Cambridge Computer
7 .\" Laboratory with support from a grant from Google, Inc.
9 .\" Portions of this documentation were written by Pawel Jakub Dawidek
10 .\" under sponsorship from the FreeBSD Foundation.
12 .\" Redistribution and use in source and binary forms, with or without
13 .\" modification, are permitted provided that the following conditions
15 .\" 1. Redistributions of source code must retain the above copyright
16 .\" notice, this list of conditions and the following disclaimer.
17 .\" 2. Redistributions in binary form must reproduce the above copyright
18 .\" notice, this list of conditions and the following disclaimer in the
19 .\" documentation and/or other materials provided with the distribution.
21 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 .Dt CAP_RIGHTS_LIMIT 2
39 .Nm cap_rights_limit ,
41 .Nd manage capability rights
47 .Fn cap_rights_limit "int fd" "cap_rights_t rights"
49 .Fn cap_rights_get "int fd" "cap_rights_t *rightsp"
51 When a file descriptor is created by a function such as
63 it is assigned all capability rights.
64 Those rights can be reduced (but never expanded) by using the
67 Once capability rights are reduced, operations on the file descriptor will be
68 limited to those permitted by
71 A bitmask of capability rights assigned to a file descriptor can be obtained with
76 The following rights may be specified in a rights mask:
77 .Bl -tag -width CAP_EXTATTR_DELETE
84 Permit checking of an ACL on a file descriptor; there is no cross-reference
88 .Xr acl_delete_fd_np 3 .
102 Note that sockets can also become bound implicitly as a result of
106 and that socket options set with
108 may also affect binding behavior.
112 This right has to be present on the directory descriptor.
118 with a non-NULL destination address.
122 This right has to be present on the directory descriptor.
129 .\" XXXPJD: Doesn't exist anymore.
136 to be used in monitoring the file descriptor for events.
146 will also be required.
147 .It Dv CAP_EXTATTR_DELETE
149 .Xr extattr_delete_fd 2 .
150 .It Dv CAP_EXTATTR_GET
152 .Xr extattr_get_fd 2 .
153 .It Dv CAP_EXTATTR_LIST
155 .Xr extattr_list_fd 2 .
156 .It Dv CAP_EXTATTR_SET
158 .Xr extattr_set_fd 2 .
195 commands require this capability right.
196 Also note that the list of permitted commands can be further limited with the
197 .Xr cap_fcntls_limit 2
219 Permit UFS background-fsck operations on the descriptor.
258 .It Dv CAP_GETPEERNAME
261 .It Dv CAP_GETSOCKNAME
264 .It Dv CAP_GETSOCKOPT
270 Be aware that this system call has enormous scope, including potentially
271 global scope for some objects.
272 The list of permitted ioctl commands can be further limited with the
273 .Xr cap_ioctls_limit 2
275 .\" XXXPJD: Doesn't exist anymore.
280 is also required on file descriptors that will be monitored using
287 This right is required for the destination directory descriptor.
291 not much use (generally) without
294 Permit the file descriptor to be used as a starting directory for calls such as
384 .\" XXXPJD: Not documented.
385 .It Dv CAP_POLL_EVENT
386 .\" XXXPJD: Not documented.
387 .It Dv CAP_POST_EVENT
408 and related system calls.
415 This right is required for the source directory descriptor.
417 Permit operations that seek on the file descriptor, such as
419 but also required for I/O system calls that can read or write at any position
424 .It Dv CAP_SEM_GETVALUE
438 .It Dv CAP_SETSOCKOPT
441 this controls various aspects of socket behavior and may affect binding,
442 connecting, and other behaviors with global scope.
446 closing the socket will also generally shut down any connections on it.
451 Allow configuration of TTY hooks, such as
453 on the file descriptor.
459 This right is only required for
461 on the destination directory descriptor if the destination object already
462 exists and will be removed by the rename.
476 and related system calls.
479 with a non-NULL connection address,
486 flag, but without the
501 argument is not a valid active descriptor.
503 An invalid right has been requested in
505 .It Bq Er ENOTCAPABLE
507 contains requested rights not present in the current rights mask associated
508 with the given file descriptor.
517 argument is not a valid active descriptor.
521 argument points at an invalid address.
531 .Xr cap_fcntls_limit 2 ,
532 .Xr cap_ioctls_limit 2 ,
533 .Xr cap_rights_limit 2 ,
538 .Xr extattr_delete_fd 2 ,
539 .Xr extattr_get_fd 2 ,
540 .Xr extattr_list_fd 2 ,
541 .Xr extattr_set_fd 2 ,
592 .Xr acl_delete_fd_np 3 ,
594 .Xr acl_get_fd_np 3 ,
595 .Xr acl_set_fd_np 3 ,
607 Support for capabilities and capabilities mode was developed as part of the
611 This function was created by
612 .An Pawel Jakub Dawidek Aq pawel@dawidek.net
613 under sponsorship of the FreeBSD Foundation.
615 This man page should list the set of permitted system calls more specifically
616 for each capability right.
618 Capability rights sometimes have unclear indirect impacts, which should be
619 documented, or at least hinted at.