xref: /freebsd/contrib/capsicum-test/capsicum-linux.h (revision 9a696dc6bb0e8e783dfd169c8299e1f33aac2935)
1*8ac5aef8SEnji Cooper #ifndef __CAPSICUM_LINUX_H__
2*8ac5aef8SEnji Cooper #define __CAPSICUM_LINUX_H__
3*8ac5aef8SEnji Cooper 
4*8ac5aef8SEnji Cooper #ifdef __linux__
5*8ac5aef8SEnji Cooper /************************************************************
6*8ac5aef8SEnji Cooper  * Linux Capsicum Functionality.
7*8ac5aef8SEnji Cooper  ************************************************************/
8*8ac5aef8SEnji Cooper #include <errno.h>
9*8ac5aef8SEnji Cooper #include <sys/procdesc.h>
10*8ac5aef8SEnji Cooper #include <sys/capsicum.h>
11*8ac5aef8SEnji Cooper 
12*8ac5aef8SEnji Cooper #define HAVE_CAP_RIGHTS_LIMIT
13*8ac5aef8SEnji Cooper #define HAVE_CAP_RIGHTS_GET
14*8ac5aef8SEnji Cooper #define HAVE_CAP_FCNTLS_LIMIT
15*8ac5aef8SEnji Cooper #define HAVE_CAP_IOCTLS_LIMIT
16*8ac5aef8SEnji Cooper #define HAVE_PROC_FDINFO
17*8ac5aef8SEnji Cooper #define HAVE_PDWAIT4
18*8ac5aef8SEnji Cooper #define CAP_FROM_ACCEPT
19*8ac5aef8SEnji Cooper // TODO(drysdale): uncomment if/when Linux propagates rights on sctp_peeloff.
20*8ac5aef8SEnji Cooper // Linux does not generate a capability from sctp_peeloff(cap_fd,...).
21*8ac5aef8SEnji Cooper // #define CAP_FROM_PEELOFF
22*8ac5aef8SEnji Cooper // TODO(drysdale): uncomment if/when Linux allows intermediate .. path segments
23*8ac5aef8SEnji Cooper // for openat()-like operations.
24*8ac5aef8SEnji Cooper // #define HAVE_OPENAT_INTERMEDIATE_DOTDOT
25*8ac5aef8SEnji Cooper 
26*8ac5aef8SEnji Cooper // Failure to open file due to path traversal generates EPERM
27*8ac5aef8SEnji Cooper #ifdef ENOTBENEATH
28*8ac5aef8SEnji Cooper #define E_NO_TRAVERSE_CAPABILITY ENOTBENEATH
29*8ac5aef8SEnji Cooper #define E_NO_TRAVERSE_O_BENEATH ENOTBENEATH
30*8ac5aef8SEnji Cooper #else
31*8ac5aef8SEnji Cooper #define E_NO_TRAVERSE_CAPABILITY EPERM
32*8ac5aef8SEnji Cooper #define E_NO_TRAVERSE_O_BENEATH EPERM
33*8ac5aef8SEnji Cooper #endif
34*8ac5aef8SEnji Cooper 
35*8ac5aef8SEnji Cooper // Too many links
36*8ac5aef8SEnji Cooper #define E_TOO_MANY_LINKS ELOOP
37*8ac5aef8SEnji Cooper 
38*8ac5aef8SEnji Cooper #endif /* __linux__ */
39*8ac5aef8SEnji Cooper 
40*8ac5aef8SEnji Cooper #endif /*__CAPSICUM_LINUX_H__*/
41