]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/kern/capabilities.conf
Implement a close_range(2) syscall
[FreeBSD/FreeBSD.git] / sys / kern / capabilities.conf
1 ##
2 ## Copyright (c) 2008-2010 Robert N. M. Watson
3 ## All rights reserved.
4 ##
5 ## This software was developed at the University of Cambridge Computer
6 ## Laboratory with support from a grant from Google, Inc.
7 ##
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted provided that the following conditions
10 ## are met:
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.
16 ##
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
27 ## SUCH DAMAGE.
28 ##
29 ## List of system calls enabled in capability mode, one name per line.
30 ##
31 ## System calls listed here operate either fully or partially in the absence
32 ## of global namespaces or ambient authority.  In capability mode system calls
33 ## that operate only on global namespaces or require ambient authority have no
34 ## utility and thus are not permitted.
35 ##
36 ## Notes:
37 ## - sys_exit(2), abort2(2) and close(2) are very important.
38 ## - Sorted alphabetically, please keep it that way.
39 ##
40 ## $FreeBSD$
41 ##
42
43 ##
44 ## Allow ACL and MAC label operations by file descriptor, subject to
45 ## capability rights.  Allow MAC label operations on the current process but
46 ## we will need to scope __mac_get_pid(2).
47 ##
48 __acl_aclcheck_fd
49 __acl_delete_fd
50 __acl_get_fd
51 __acl_set_fd
52 __mac_get_fd
53 #__mac_get_pid
54 __mac_get_proc
55 __mac_set_fd
56 __mac_set_proc
57
58 ##
59 ## Allow sysctl(2) as we scope internal to the call; this is a global
60 ## namespace, but there are several critical sysctls required for almost
61 ## anything to run, such as hw.pagesize.  For now that policy lives in the
62 ## kernel for performance and simplicity, but perhaps it could move to a
63 ## proxying daemon in userspace.
64 ##
65 __sysctl
66 __sysctlbyname
67
68 ##
69 ## Allow umtx operations as these are scoped by address space.
70 ##
71 ## XXRW: Need to check this very carefully.
72 ##
73 _umtx_op
74
75 ##
76 ## Allow process termination using abort2(2).
77 ##
78 abort2
79
80 ##
81 ## Allow accept(2) since it doesn't manipulate namespaces directly, rather
82 ## relies on existing bindings on a socket, subject to capability rights.
83 ##
84 accept
85 accept4
86
87 ##
88 ## Allow AIO operations by file descriptor, subject to capability rights.
89 ##
90 aio_cancel
91 aio_error
92 aio_fsync
93 aio_read
94 aio_return
95 aio_suspend
96 aio_waitcomplete
97 aio_write
98
99 ##
100 ## audit(2) is a global operation, submitting to the global trail, but it is
101 ## controlled by privilege, and it might be useful to be able to submit
102 ## records from sandboxes.  For now, disallow, but we may want to think about
103 ## providing some sort of proxy service for this.
104 ##
105 #audit
106
107 ##
108 ## Allow bindat(2).
109 ##
110 bindat
111
112 ##
113 ## Allow capability mode and capability system calls.
114 ##
115 cap_enter
116 cap_fcntls_get
117 cap_fcntls_limit
118 cap_getmode
119 cap_ioctls_get
120 cap_ioctls_limit
121 __cap_rights_get
122 cap_rights_limit
123
124 ##
125 ## Allow read-only clock operations.
126 ##
127 clock_getres
128 clock_gettime
129
130 ##
131 ## Always allow file descriptor close(2).
132 ##
133 close
134 close_range
135 closefrom
136
137 ##
138 ## Allow connectat(2).
139 ##
140 connectat
141
142 ##
143 ## copy_file_range(2) reads from one descriptor and writes to the other.
144 ##
145 copy_file_range
146
147 ##
148 ## cpuset(2) and related calls are limited to caller's own process/thread.
149 ##
150 #cpuset
151 cpuset_getaffinity
152 #cpuset_getid
153 cpuset_setaffinity
154 #cpuset_setid
155
156 ##
157 ## Always allow dup(2) and dup2(2) manipulation of the file descriptor table.
158 ##
159 dup
160 dup2
161
162 ##
163 ## Allow extended attribute operations by file descriptor, subject to
164 ## capability rights.
165 ##
166 extattr_delete_fd
167 extattr_get_fd
168 extattr_list_fd
169 extattr_set_fd
170
171 ##
172 ## Allow changing file flags, mode, and owner by file descriptor, subject to
173 ## capability rights.
174 ##
175 fchflags
176 fchmod
177 fchown
178
179 ##
180 ## For now, allow fcntl(2), subject to capability rights, but this probably
181 ## needs additional scoping.
182 ##
183 fcntl
184
185 ##
186 ## Allow fexecve(2), subject to capability rights.  We perform some scoping,
187 ## such as disallowing privilege escalation.
188 ##
189 fexecve
190
191 ##
192 ## Allow flock(2), subject to capability rights.
193 ##
194 flock
195
196 ##
197 ## Allow fork(2), even though it returns pids -- some applications seem to
198 ## prefer this interface.
199 ##
200 fork
201
202 ##
203 ## Allow fpathconf(2), subject to capability rights.
204 ##
205 fpathconf
206
207 ##
208 ## Allow various file descriptor-based I/O operations, subject to capability
209 ## rights.
210 ##
211 freebsd11_fstat
212 freebsd11_fstatat
213 freebsd11_getdirentries
214 freebsd11_fstatfs
215 freebsd11_mknodat
216 freebsd6_ftruncate
217 freebsd6_lseek
218 freebsd6_mmap
219 freebsd6_pread
220 freebsd6_pwrite
221
222 ##
223 ## Allow querying file and file system state with fstat(2) and fstatfs(2),
224 ## subject to capability rights.
225 ##
226 fstat
227 fstatfs
228
229 ##
230 ## Allow further file descriptor-based I/O operations, subject to capability
231 ## rights.
232 ##
233 fdatasync
234 fsync
235 ftruncate
236
237 ##
238 ## Allow futimens(2) and futimes(2), subject to capability rights.
239 ##
240 futimens
241 futimes
242
243 ##
244 ## Allow querying process audit state, subject to normal access control.
245 ##
246 getaudit
247 getaudit_addr
248 getauid
249
250 ##
251 ## Allow thread context management with getcontext(2).
252 ##
253 getcontext
254
255 ##
256 ## Allow directory I/O on a file descriptor, subject to capability rights.
257 ## Originally we had separate capabilities for directory-specific read
258 ## operations, but on BSD we allow reading the raw directory data, so we just
259 ## rely on CAP_READ now.
260 ##
261 getdents
262 getdirentries
263
264 ##
265 ## Allow querying certain trivial global state.
266 ##
267 getdomainname
268
269 ##
270 ## Allow querying certain per-process resource limit state.
271 ##
272 getdtablesize
273
274 ##
275 ## Allow querying current process credential state.
276 ##
277 getegid
278 geteuid
279
280 ##
281 ## Allow querying certain trivial global state.
282 ##
283 gethostid
284 gethostname
285
286 ##
287 ## Allow querying per-process timer.
288 ##
289 getitimer
290
291 ##
292 ## Allow querying current process credential state.
293 ##
294 getgid
295 getgroups
296 getlogin
297 getloginclass
298
299 ##
300 ## Allow querying certain trivial global state.
301 ##
302 getpagesize
303 getpeername
304
305 ##
306 ## Allow querying certain per-process scheduling, resource limit, and
307 ## credential state.
308 ##
309 ## XXXRW: getpgid(2) needs scoping.  It's not clear if it's worth scoping
310 ## getppid(2).  getpriority(2) needs scoping.  getrusage(2) needs scoping.
311 ## getsid(2) needs scoping.
312 ##
313 getpgid
314 getpgrp
315 getpid
316 getppid
317 getpriority
318 getresgid
319 getresuid
320 getrlimit
321 getrusage
322 getsid
323
324 ##
325 ## Allow getrandom
326 ##
327 getrandom
328
329 ##
330 ## Allow querying socket state, subject to capability rights.
331 ##
332 ## XXXRW: getsockopt(2) may need more attention.
333 ##
334 getsockname
335 getsockopt
336
337 ##
338 ## Allow querying the global clock.
339 ##
340 gettimeofday
341
342 ##
343 ## Allow querying current process credential state.
344 ##
345 getuid
346
347 ##
348 ## Allow ioctl(2), which hopefully will be limited by applications only to
349 ## required commands with cap_ioctls_limit(2) syscall.
350 ##
351 ioctl
352
353 ##
354 ## Allow querying current process credential state.
355 ##
356 issetugid
357
358 ##
359 ## Allow kevent(2), as we will authorize based on capability rights on the
360 ## target descriptor.
361 ##
362 kevent
363
364 ##
365 ## Allow kill(2), as we allow the process to send signals only to himself.
366 ##
367 kill
368
369 ##
370 ## Allow message queue operations on file descriptors, subject to capability
371 ## rights.
372 ## NOTE: Corresponding sysents are initialized in sys/kern/uipc_mqueue.c with
373 ## SYF_CAPENABLED.
374 ##
375 kmq_notify
376 kmq_setattr
377 kmq_timedreceive
378 kmq_timedsend
379
380 ##
381 ## Allow kqueue(2), we will control use.
382 ##
383 kqueue
384
385 ##
386 ## Allow managing per-process timers.
387 ##
388 ktimer_create
389 ktimer_delete
390 ktimer_getoverrun
391 ktimer_gettime
392 ktimer_settime
393
394 ##
395 ## We can't allow ktrace(2) because it relies on a global namespace, but we
396 ## might want to introduce an fktrace(2) of some sort.
397 ##
398 #ktrace
399
400 ##
401 ## Allow AIO operations by file descriptor, subject to capability rights.
402 ##
403 lio_listio
404
405 ##
406 ## Allow listen(2), subject to capability rights.
407 ##
408 ## XXXRW: One might argue this manipulates a global namespace.
409 ##
410 listen
411
412 ##
413 ## Allow I/O-related file descriptors, subject to capability rights.
414 ##
415 lseek
416
417 ##
418 ## Allow simple VM operations on the current process.
419 ##
420 madvise
421 mincore
422 minherit
423 mlock
424 mlockall
425
426 ##
427 ## Allow memory mapping a file descriptor, and updating protections, subject
428 ## to capability rights.
429 ##
430 mmap
431 mprotect
432
433 ##
434 ## Allow simple VM operations on the current process.
435 ##
436 msync
437 munlock
438 munlockall
439 munmap
440
441 ##
442 ## Allow the current process to sleep.
443 ##
444 nanosleep
445
446 ##
447 ## Allow querying the global clock.
448 ##
449 ntp_gettime
450
451 ##
452 ## Allow AIO operations by file descriptor, subject to capability rights.
453 ##
454 oaio_read
455 oaio_write
456
457 ##
458 ## Allow simple VM operations on the current process.
459 ##
460 break
461
462 ##
463 ## Allow AIO operations by file descriptor, subject to capability rights.
464 ##
465 olio_listio
466
467 ##
468 ## Operations relative to directory capabilities.
469 ##
470 chflagsat
471 faccessat
472 fchmodat
473 fchownat
474 fstatat
475 futimesat
476 linkat
477 mkdirat
478 mkfifoat
479 mknodat
480 openat
481 readlinkat
482 renameat
483 symlinkat
484 unlinkat
485 funlinkat
486 utimensat
487
488 ##
489 ## Process descriptor-related system calls are allowed.
490 ##
491 pdfork
492 pdgetpid
493 pdkill
494 #pdwait4        # not yet implemented
495
496 ##
497 ## Allow pipe(2).
498 ##
499 pipe
500 pipe2
501
502 ##
503 ## Allow poll(2), which will be scoped by capability rights.
504 ##
505 poll
506 ppoll
507
508 ##
509 ## Allow I/O-related file descriptors, subject to capability rights.
510 ##
511 posix_fallocate
512 pread
513 preadv
514
515 ##
516 ## Allow access to profiling state on the current process.
517 ##
518 profil
519
520 ##
521 ## Disallow ptrace(2) for now, but we do need debugging facilities in
522 ## capability mode, so we will want to revisit this, possibly by scoping its
523 ## operation.
524 ##
525 #ptrace
526
527 ##
528 ## Allow I/O-related file descriptors, subject to capability rights.
529 ##
530 pwrite
531 pwritev
532 read
533 readv
534 recv
535 recvfrom
536 recvmsg
537
538 ##
539 ## Allow real-time scheduling primitives to be used.
540 ##
541 ## XXXRW: These require scoping.
542 ##
543 rtprio
544 rtprio_thread
545
546 ##
547 ## Allow simple VM operations on the current process.
548 ##
549 sbrk
550
551 ##
552 ## Allow querying trivial global scheduler state.
553 ##
554 sched_get_priority_max
555 sched_get_priority_min
556
557 ##
558 ## Allow various thread/process scheduler operations.
559 ##
560 ## XXXRW: Some of these require further scoping.
561 ##
562 sched_getparam
563 sched_getscheduler
564 sched_rr_get_interval
565 sched_setparam
566 sched_setscheduler
567 sched_yield
568
569 ##
570 ## Allow I/O-related file descriptors, subject to capability rights.
571 ## NOTE: Corresponding sysents are initialized in sys/netinet/sctp_syscalls.c
572 ## with SYF_CAPENABLED.
573 ##
574 sctp_generic_recvmsg
575 sctp_generic_sendmsg
576 sctp_generic_sendmsg_iov
577 sctp_peeloff
578
579 ##
580 ## Allow pselect(2) and select(2), which will be scoped by capability rights.
581 ##
582 ## XXXRW: But is it?
583 ##
584 pselect
585 select
586
587 ##
588 ## Allow I/O-related file descriptors, subject to capability rights.  Use of
589 ## explicit addresses here is restricted by the system calls themselves.
590 ##
591 send
592 sendfile
593 sendmsg
594 sendto
595
596 ##
597 ## Allow setting per-process audit state, which is controlled separately by
598 ## privileges.
599 ##
600 setaudit
601 setaudit_addr
602 setauid
603
604 ##
605 ## Allow setting thread context.
606 ##
607 setcontext
608
609 ##
610 ## Allow setting current process credential state, which is controlled
611 ## separately by privilege.
612 ##
613 setegid
614 seteuid
615 setgid
616
617 ##
618 ## Allow use of the process interval timer.
619 ##
620 setitimer
621
622 ##
623 ## Allow setpriority(2).
624 ##
625 ## XXXRW: Requires scoping.
626 ##
627 setpriority
628
629 ##
630 ## Allow setting current process credential state, which is controlled
631 ## separately by privilege.
632 ##
633 setregid
634 setresgid
635 setresuid
636 setreuid
637
638 ##
639 ## Allow setting process resource limits with setrlimit(2).
640 ##
641 setrlimit
642
643 ##
644 ## Allow creating a new session with setsid(2).
645 ##
646 setsid
647
648 ##
649 ## Allow setting socket options with setsockopt(2), subject to capability
650 ## rights.
651 ##
652 ## XXXRW: Might require scoping.
653 ##
654 setsockopt
655
656 ##
657 ## Allow setting current process credential state, which is controlled
658 ## separately by privilege.
659 ##
660 setuid
661
662 ##
663 ## shm_open(2) is scoped so as to allow only access to new anonymous objects.
664 ##
665 shm_open
666 shm_open2
667
668 ##
669 ## Allow I/O-related file descriptors, subject to capability rights.
670 ##
671 shutdown
672
673 ##
674 ## Allow signal control on current process.
675 ##
676 sigaction
677 sigaltstack
678 sigblock
679 sigfastblock
680 sigpending
681 sigprocmask
682 sigqueue
683 sigreturn
684 sigsetmask
685 sigstack
686 sigsuspend
687 sigtimedwait
688 sigvec
689 sigwaitinfo
690 sigwait
691
692 ##
693 ## Allow creating new socket pairs with socket(2) and socketpair(2).
694 ##
695 socket
696 socketpair
697
698 ##
699 ## Allow simple VM operations on the current process.
700 ##
701 ## XXXRW: Kernel doesn't implement this, so drop?
702 ##
703 sstk
704
705 ##
706 ## Do allow sync(2) for now, but possibly shouldn't.
707 ##
708 sync
709
710 ##
711 ## Always allow process termination with sys_exit(2).
712 ##
713 sys_exit
714
715 ##
716 ## sysarch(2) does rather diverse things, but is required on at least i386
717 ## in order to configure per-thread data.  As such, it's scoped on each
718 ## architecture.
719 ##
720 sysarch
721
722 ##
723 ## Allow thread operations operating only on current process.
724 ##
725 thr_create
726 thr_exit
727 thr_kill
728
729 ##
730 ## Disallow thr_kill2(2), as it may operate beyond the current process.
731 ##
732 ## XXXRW: Requires scoping.
733 ##
734 #thr_kill2
735
736 ##
737 ## Allow thread operations operating only on current process.
738 ##
739 thr_new
740 thr_self
741 thr_set_name
742 thr_suspend
743 thr_wake
744
745 ##
746 ## Allow manipulation of the current process umask with umask(2).
747 ##
748 umask
749
750 ##
751 ## Allow submitting of process trace entries with utrace(2).
752 ##
753 utrace
754
755 ##
756 ## Allow generating UUIDs with uuidgen(2).
757 ##
758 uuidgen
759
760 ##
761 ## Allow I/O-related file descriptors, subject to capability rights.
762 ##
763 write
764 writev
765
766 ##
767 ## Allow processes to yield(2).
768 ##
769 yield