xref: /utopia/UTPA2-700.0.x/projects/tools/lint/mips-linux-gnu_include/linux/capability.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1*53ee8cc1Swenshuai.xi /*
2*53ee8cc1Swenshuai.xi  * This is <linux/capability.h>
3*53ee8cc1Swenshuai.xi  *
4*53ee8cc1Swenshuai.xi  * Andrew G. Morgan <morgan@kernel.org>
5*53ee8cc1Swenshuai.xi  * Alexander Kjeldaas <astor@guardian.no>
6*53ee8cc1Swenshuai.xi  * with help from Aleph1, Roland Buresund and Andrew Main.
7*53ee8cc1Swenshuai.xi  *
8*53ee8cc1Swenshuai.xi  * See here for the libcap library ("POSIX draft" compliance):
9*53ee8cc1Swenshuai.xi  *
10*53ee8cc1Swenshuai.xi  * ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
11*53ee8cc1Swenshuai.xi  */
12*53ee8cc1Swenshuai.xi 
13*53ee8cc1Swenshuai.xi #ifndef _LINUX_CAPABILITY_H
14*53ee8cc1Swenshuai.xi #define _LINUX_CAPABILITY_H
15*53ee8cc1Swenshuai.xi 
16*53ee8cc1Swenshuai.xi #include <linux/types.h>
17*53ee8cc1Swenshuai.xi 
18*53ee8cc1Swenshuai.xi struct task_struct;
19*53ee8cc1Swenshuai.xi 
20*53ee8cc1Swenshuai.xi /* User-level do most of the mapping between kernel and user
21*53ee8cc1Swenshuai.xi    capabilities based on the version tag given by the kernel. The
22*53ee8cc1Swenshuai.xi    kernel might be somewhat backwards compatible, but don't bet on
23*53ee8cc1Swenshuai.xi    it. */
24*53ee8cc1Swenshuai.xi 
25*53ee8cc1Swenshuai.xi /* Note, cap_t, is defined by POSIX (draft) to be an "opaque" pointer to
26*53ee8cc1Swenshuai.xi    a set of three capability sets.  The transposition of 3*the
27*53ee8cc1Swenshuai.xi    following structure to such a composite is better handled in a user
28*53ee8cc1Swenshuai.xi    library since the draft standard requires the use of malloc/free
29*53ee8cc1Swenshuai.xi    etc.. */
30*53ee8cc1Swenshuai.xi 
31*53ee8cc1Swenshuai.xi #define _LINUX_CAPABILITY_VERSION_1  0x19980330
32*53ee8cc1Swenshuai.xi #define _LINUX_CAPABILITY_U32S_1     1
33*53ee8cc1Swenshuai.xi 
34*53ee8cc1Swenshuai.xi #define _LINUX_CAPABILITY_VERSION_2  0x20071026  /* deprecated - use v3 */
35*53ee8cc1Swenshuai.xi #define _LINUX_CAPABILITY_U32S_2     2
36*53ee8cc1Swenshuai.xi 
37*53ee8cc1Swenshuai.xi #define _LINUX_CAPABILITY_VERSION_3  0x20080522
38*53ee8cc1Swenshuai.xi #define _LINUX_CAPABILITY_U32S_3     2
39*53ee8cc1Swenshuai.xi 
40*53ee8cc1Swenshuai.xi typedef struct __user_cap_header_struct {
41*53ee8cc1Swenshuai.xi 	__u32 version;
42*53ee8cc1Swenshuai.xi 	int pid;
43*53ee8cc1Swenshuai.xi } *cap_user_header_t;
44*53ee8cc1Swenshuai.xi 
45*53ee8cc1Swenshuai.xi typedef struct __user_cap_data_struct {
46*53ee8cc1Swenshuai.xi         __u32 effective;
47*53ee8cc1Swenshuai.xi         __u32 permitted;
48*53ee8cc1Swenshuai.xi         __u32 inheritable;
49*53ee8cc1Swenshuai.xi } *cap_user_data_t;
50*53ee8cc1Swenshuai.xi 
51*53ee8cc1Swenshuai.xi 
52*53ee8cc1Swenshuai.xi #define XATTR_CAPS_SUFFIX "capability"
53*53ee8cc1Swenshuai.xi #define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
54*53ee8cc1Swenshuai.xi 
55*53ee8cc1Swenshuai.xi #define VFS_CAP_REVISION_MASK	0xFF000000
56*53ee8cc1Swenshuai.xi #define VFS_CAP_FLAGS_MASK	~VFS_CAP_REVISION_MASK
57*53ee8cc1Swenshuai.xi #define VFS_CAP_FLAGS_EFFECTIVE	0x000001
58*53ee8cc1Swenshuai.xi 
59*53ee8cc1Swenshuai.xi #define VFS_CAP_REVISION_1	0x01000000
60*53ee8cc1Swenshuai.xi #define VFS_CAP_U32_1           1
61*53ee8cc1Swenshuai.xi #define XATTR_CAPS_SZ_1         (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1))
62*53ee8cc1Swenshuai.xi 
63*53ee8cc1Swenshuai.xi #define VFS_CAP_REVISION_2	0x02000000
64*53ee8cc1Swenshuai.xi #define VFS_CAP_U32_2           2
65*53ee8cc1Swenshuai.xi #define XATTR_CAPS_SZ_2         (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
66*53ee8cc1Swenshuai.xi 
67*53ee8cc1Swenshuai.xi #define XATTR_CAPS_SZ           XATTR_CAPS_SZ_2
68*53ee8cc1Swenshuai.xi #define VFS_CAP_U32             VFS_CAP_U32_2
69*53ee8cc1Swenshuai.xi #define VFS_CAP_REVISION	VFS_CAP_REVISION_2
70*53ee8cc1Swenshuai.xi 
71*53ee8cc1Swenshuai.xi 
72*53ee8cc1Swenshuai.xi struct vfs_cap_data {
73*53ee8cc1Swenshuai.xi 	__le32 magic_etc;            /* Little endian */
74*53ee8cc1Swenshuai.xi 	struct {
75*53ee8cc1Swenshuai.xi 		__le32 permitted;    /* Little endian */
76*53ee8cc1Swenshuai.xi 		__le32 inheritable;  /* Little endian */
77*53ee8cc1Swenshuai.xi 	} data[VFS_CAP_U32];
78*53ee8cc1Swenshuai.xi };
79*53ee8cc1Swenshuai.xi 
80*53ee8cc1Swenshuai.xi 
81*53ee8cc1Swenshuai.xi /*
82*53ee8cc1Swenshuai.xi  * Backwardly compatible definition for source code - trapped in a
83*53ee8cc1Swenshuai.xi  * 32-bit world. If you find you need this, please consider using
84*53ee8cc1Swenshuai.xi  * libcap to untrap yourself...
85*53ee8cc1Swenshuai.xi  */
86*53ee8cc1Swenshuai.xi #define _LINUX_CAPABILITY_VERSION  _LINUX_CAPABILITY_VERSION_1
87*53ee8cc1Swenshuai.xi #define _LINUX_CAPABILITY_U32S     _LINUX_CAPABILITY_U32S_1
88*53ee8cc1Swenshuai.xi 
89*53ee8cc1Swenshuai.xi 
90*53ee8cc1Swenshuai.xi 
91*53ee8cc1Swenshuai.xi /**
92*53ee8cc1Swenshuai.xi  ** POSIX-draft defined capabilities.
93*53ee8cc1Swenshuai.xi  **/
94*53ee8cc1Swenshuai.xi 
95*53ee8cc1Swenshuai.xi /* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this
96*53ee8cc1Swenshuai.xi    overrides the restriction of changing file ownership and group
97*53ee8cc1Swenshuai.xi    ownership. */
98*53ee8cc1Swenshuai.xi 
99*53ee8cc1Swenshuai.xi #define CAP_CHOWN            0
100*53ee8cc1Swenshuai.xi 
101*53ee8cc1Swenshuai.xi /* Override all DAC access, including ACL execute access if
102*53ee8cc1Swenshuai.xi    [_POSIX_ACL] is defined. Excluding DAC access covered by
103*53ee8cc1Swenshuai.xi    CAP_LINUX_IMMUTABLE. */
104*53ee8cc1Swenshuai.xi 
105*53ee8cc1Swenshuai.xi #define CAP_DAC_OVERRIDE     1
106*53ee8cc1Swenshuai.xi 
107*53ee8cc1Swenshuai.xi /* Overrides all DAC restrictions regarding read and search on files
108*53ee8cc1Swenshuai.xi    and directories, including ACL restrictions if [_POSIX_ACL] is
109*53ee8cc1Swenshuai.xi    defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */
110*53ee8cc1Swenshuai.xi 
111*53ee8cc1Swenshuai.xi #define CAP_DAC_READ_SEARCH  2
112*53ee8cc1Swenshuai.xi 
113*53ee8cc1Swenshuai.xi /* Overrides all restrictions about allowed operations on files, where
114*53ee8cc1Swenshuai.xi    file owner ID must be equal to the user ID, except where CAP_FSETID
115*53ee8cc1Swenshuai.xi    is applicable. It doesn't override MAC and DAC restrictions. */
116*53ee8cc1Swenshuai.xi 
117*53ee8cc1Swenshuai.xi #define CAP_FOWNER           3
118*53ee8cc1Swenshuai.xi 
119*53ee8cc1Swenshuai.xi /* Overrides the following restrictions that the effective user ID
120*53ee8cc1Swenshuai.xi    shall match the file owner ID when setting the S_ISUID and S_ISGID
121*53ee8cc1Swenshuai.xi    bits on that file; that the effective group ID (or one of the
122*53ee8cc1Swenshuai.xi    supplementary group IDs) shall match the file owner ID when setting
123*53ee8cc1Swenshuai.xi    the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are
124*53ee8cc1Swenshuai.xi    cleared on successful return from chown(2) (not implemented). */
125*53ee8cc1Swenshuai.xi 
126*53ee8cc1Swenshuai.xi #define CAP_FSETID           4
127*53ee8cc1Swenshuai.xi 
128*53ee8cc1Swenshuai.xi /* Overrides the restriction that the real or effective user ID of a
129*53ee8cc1Swenshuai.xi    process sending a signal must match the real or effective user ID
130*53ee8cc1Swenshuai.xi    of the process receiving the signal. */
131*53ee8cc1Swenshuai.xi 
132*53ee8cc1Swenshuai.xi #define CAP_KILL             5
133*53ee8cc1Swenshuai.xi 
134*53ee8cc1Swenshuai.xi /* Allows setgid(2) manipulation */
135*53ee8cc1Swenshuai.xi /* Allows setgroups(2) */
136*53ee8cc1Swenshuai.xi /* Allows forged gids on socket credentials passing. */
137*53ee8cc1Swenshuai.xi 
138*53ee8cc1Swenshuai.xi #define CAP_SETGID           6
139*53ee8cc1Swenshuai.xi 
140*53ee8cc1Swenshuai.xi /* Allows set*uid(2) manipulation (including fsuid). */
141*53ee8cc1Swenshuai.xi /* Allows forged pids on socket credentials passing. */
142*53ee8cc1Swenshuai.xi 
143*53ee8cc1Swenshuai.xi #define CAP_SETUID           7
144*53ee8cc1Swenshuai.xi 
145*53ee8cc1Swenshuai.xi 
146*53ee8cc1Swenshuai.xi /**
147*53ee8cc1Swenshuai.xi  ** Linux-specific capabilities
148*53ee8cc1Swenshuai.xi  **/
149*53ee8cc1Swenshuai.xi 
150*53ee8cc1Swenshuai.xi /* Without VFS support for capabilities:
151*53ee8cc1Swenshuai.xi  *   Transfer any capability in your permitted set to any pid,
152*53ee8cc1Swenshuai.xi  *   remove any capability in your permitted set from any pid
153*53ee8cc1Swenshuai.xi  * With VFS support for capabilities (neither of above, but)
154*53ee8cc1Swenshuai.xi  *   Add any capability from current's capability bounding set
155*53ee8cc1Swenshuai.xi  *       to the current process' inheritable set
156*53ee8cc1Swenshuai.xi  *   Allow taking bits out of capability bounding set
157*53ee8cc1Swenshuai.xi  *   Allow modification of the securebits for a process
158*53ee8cc1Swenshuai.xi  */
159*53ee8cc1Swenshuai.xi 
160*53ee8cc1Swenshuai.xi #define CAP_SETPCAP          8
161*53ee8cc1Swenshuai.xi 
162*53ee8cc1Swenshuai.xi /* Allow modification of S_IMMUTABLE and S_APPEND file attributes */
163*53ee8cc1Swenshuai.xi 
164*53ee8cc1Swenshuai.xi #define CAP_LINUX_IMMUTABLE  9
165*53ee8cc1Swenshuai.xi 
166*53ee8cc1Swenshuai.xi /* Allows binding to TCP/UDP sockets below 1024 */
167*53ee8cc1Swenshuai.xi /* Allows binding to ATM VCIs below 32 */
168*53ee8cc1Swenshuai.xi 
169*53ee8cc1Swenshuai.xi #define CAP_NET_BIND_SERVICE 10
170*53ee8cc1Swenshuai.xi 
171*53ee8cc1Swenshuai.xi /* Allow broadcasting, listen to multicast */
172*53ee8cc1Swenshuai.xi 
173*53ee8cc1Swenshuai.xi #define CAP_NET_BROADCAST    11
174*53ee8cc1Swenshuai.xi 
175*53ee8cc1Swenshuai.xi /* Allow interface configuration */
176*53ee8cc1Swenshuai.xi /* Allow administration of IP firewall, masquerading and accounting */
177*53ee8cc1Swenshuai.xi /* Allow setting debug option on sockets */
178*53ee8cc1Swenshuai.xi /* Allow modification of routing tables */
179*53ee8cc1Swenshuai.xi /* Allow setting arbitrary process / process group ownership on
180*53ee8cc1Swenshuai.xi    sockets */
181*53ee8cc1Swenshuai.xi /* Allow binding to any address for transparent proxying */
182*53ee8cc1Swenshuai.xi /* Allow setting TOS (type of service) */
183*53ee8cc1Swenshuai.xi /* Allow setting promiscuous mode */
184*53ee8cc1Swenshuai.xi /* Allow clearing driver statistics */
185*53ee8cc1Swenshuai.xi /* Allow multicasting */
186*53ee8cc1Swenshuai.xi /* Allow read/write of device-specific registers */
187*53ee8cc1Swenshuai.xi /* Allow activation of ATM control sockets */
188*53ee8cc1Swenshuai.xi 
189*53ee8cc1Swenshuai.xi #define CAP_NET_ADMIN        12
190*53ee8cc1Swenshuai.xi 
191*53ee8cc1Swenshuai.xi /* Allow use of RAW sockets */
192*53ee8cc1Swenshuai.xi /* Allow use of PACKET sockets */
193*53ee8cc1Swenshuai.xi 
194*53ee8cc1Swenshuai.xi #define CAP_NET_RAW          13
195*53ee8cc1Swenshuai.xi 
196*53ee8cc1Swenshuai.xi /* Allow locking of shared memory segments */
197*53ee8cc1Swenshuai.xi /* Allow mlock and mlockall (which doesn't really have anything to do
198*53ee8cc1Swenshuai.xi    with IPC) */
199*53ee8cc1Swenshuai.xi 
200*53ee8cc1Swenshuai.xi #define CAP_IPC_LOCK         14
201*53ee8cc1Swenshuai.xi 
202*53ee8cc1Swenshuai.xi /* Override IPC ownership checks */
203*53ee8cc1Swenshuai.xi 
204*53ee8cc1Swenshuai.xi #define CAP_IPC_OWNER        15
205*53ee8cc1Swenshuai.xi 
206*53ee8cc1Swenshuai.xi /* Insert and remove kernel modules - modify kernel without limit */
207*53ee8cc1Swenshuai.xi #define CAP_SYS_MODULE       16
208*53ee8cc1Swenshuai.xi 
209*53ee8cc1Swenshuai.xi /* Allow ioperm/iopl access */
210*53ee8cc1Swenshuai.xi /* Allow sending USB messages to any device via /proc/bus/usb */
211*53ee8cc1Swenshuai.xi 
212*53ee8cc1Swenshuai.xi #define CAP_SYS_RAWIO        17
213*53ee8cc1Swenshuai.xi 
214*53ee8cc1Swenshuai.xi /* Allow use of chroot() */
215*53ee8cc1Swenshuai.xi 
216*53ee8cc1Swenshuai.xi #define CAP_SYS_CHROOT       18
217*53ee8cc1Swenshuai.xi 
218*53ee8cc1Swenshuai.xi /* Allow ptrace() of any process */
219*53ee8cc1Swenshuai.xi 
220*53ee8cc1Swenshuai.xi #define CAP_SYS_PTRACE       19
221*53ee8cc1Swenshuai.xi 
222*53ee8cc1Swenshuai.xi /* Allow configuration of process accounting */
223*53ee8cc1Swenshuai.xi 
224*53ee8cc1Swenshuai.xi #define CAP_SYS_PACCT        20
225*53ee8cc1Swenshuai.xi 
226*53ee8cc1Swenshuai.xi /* Allow configuration of the secure attention key */
227*53ee8cc1Swenshuai.xi /* Allow administration of the random device */
228*53ee8cc1Swenshuai.xi /* Allow examination and configuration of disk quotas */
229*53ee8cc1Swenshuai.xi /* Allow configuring the kernel's syslog (printk behaviour) */
230*53ee8cc1Swenshuai.xi /* Allow setting the domainname */
231*53ee8cc1Swenshuai.xi /* Allow setting the hostname */
232*53ee8cc1Swenshuai.xi /* Allow calling bdflush() */
233*53ee8cc1Swenshuai.xi /* Allow mount() and umount(), setting up new smb connection */
234*53ee8cc1Swenshuai.xi /* Allow some autofs root ioctls */
235*53ee8cc1Swenshuai.xi /* Allow nfsservctl */
236*53ee8cc1Swenshuai.xi /* Allow VM86_REQUEST_IRQ */
237*53ee8cc1Swenshuai.xi /* Allow to read/write pci config on alpha */
238*53ee8cc1Swenshuai.xi /* Allow irix_prctl on mips (setstacksize) */
239*53ee8cc1Swenshuai.xi /* Allow flushing all cache on m68k (sys_cacheflush) */
240*53ee8cc1Swenshuai.xi /* Allow removing semaphores */
241*53ee8cc1Swenshuai.xi /* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores
242*53ee8cc1Swenshuai.xi    and shared memory */
243*53ee8cc1Swenshuai.xi /* Allow locking/unlocking of shared memory segment */
244*53ee8cc1Swenshuai.xi /* Allow turning swap on/off */
245*53ee8cc1Swenshuai.xi /* Allow forged pids on socket credentials passing */
246*53ee8cc1Swenshuai.xi /* Allow setting readahead and flushing buffers on block devices */
247*53ee8cc1Swenshuai.xi /* Allow setting geometry in floppy driver */
248*53ee8cc1Swenshuai.xi /* Allow turning DMA on/off in xd driver */
249*53ee8cc1Swenshuai.xi /* Allow administration of md devices (mostly the above, but some
250*53ee8cc1Swenshuai.xi    extra ioctls) */
251*53ee8cc1Swenshuai.xi /* Allow tuning the ide driver */
252*53ee8cc1Swenshuai.xi /* Allow access to the nvram device */
253*53ee8cc1Swenshuai.xi /* Allow administration of apm_bios, serial and bttv (TV) device */
254*53ee8cc1Swenshuai.xi /* Allow manufacturer commands in isdn CAPI support driver */
255*53ee8cc1Swenshuai.xi /* Allow reading non-standardized portions of pci configuration space */
256*53ee8cc1Swenshuai.xi /* Allow DDI debug ioctl on sbpcd driver */
257*53ee8cc1Swenshuai.xi /* Allow setting up serial ports */
258*53ee8cc1Swenshuai.xi /* Allow sending raw qic-117 commands */
259*53ee8cc1Swenshuai.xi /* Allow enabling/disabling tagged queuing on SCSI controllers and sending
260*53ee8cc1Swenshuai.xi    arbitrary SCSI commands */
261*53ee8cc1Swenshuai.xi /* Allow setting encryption key on loopback filesystem */
262*53ee8cc1Swenshuai.xi /* Allow setting zone reclaim policy */
263*53ee8cc1Swenshuai.xi 
264*53ee8cc1Swenshuai.xi #define CAP_SYS_ADMIN        21
265*53ee8cc1Swenshuai.xi 
266*53ee8cc1Swenshuai.xi /* Allow use of reboot() */
267*53ee8cc1Swenshuai.xi 
268*53ee8cc1Swenshuai.xi #define CAP_SYS_BOOT         22
269*53ee8cc1Swenshuai.xi 
270*53ee8cc1Swenshuai.xi /* Allow raising priority and setting priority on other (different
271*53ee8cc1Swenshuai.xi    UID) processes */
272*53ee8cc1Swenshuai.xi /* Allow use of FIFO and round-robin (realtime) scheduling on own
273*53ee8cc1Swenshuai.xi    processes and setting the scheduling algorithm used by another
274*53ee8cc1Swenshuai.xi    process. */
275*53ee8cc1Swenshuai.xi /* Allow setting cpu affinity on other processes */
276*53ee8cc1Swenshuai.xi 
277*53ee8cc1Swenshuai.xi #define CAP_SYS_NICE         23
278*53ee8cc1Swenshuai.xi 
279*53ee8cc1Swenshuai.xi /* Override resource limits. Set resource limits. */
280*53ee8cc1Swenshuai.xi /* Override quota limits. */
281*53ee8cc1Swenshuai.xi /* Override reserved space on ext2 filesystem */
282*53ee8cc1Swenshuai.xi /* Modify data journaling mode on ext3 filesystem (uses journaling
283*53ee8cc1Swenshuai.xi    resources) */
284*53ee8cc1Swenshuai.xi /* NOTE: ext2 honors fsuid when checking for resource overrides, so
285*53ee8cc1Swenshuai.xi    you can override using fsuid too */
286*53ee8cc1Swenshuai.xi /* Override size restrictions on IPC message queues */
287*53ee8cc1Swenshuai.xi /* Allow more than 64hz interrupts from the real-time clock */
288*53ee8cc1Swenshuai.xi /* Override max number of consoles on console allocation */
289*53ee8cc1Swenshuai.xi /* Override max number of keymaps */
290*53ee8cc1Swenshuai.xi 
291*53ee8cc1Swenshuai.xi #define CAP_SYS_RESOURCE     24
292*53ee8cc1Swenshuai.xi 
293*53ee8cc1Swenshuai.xi /* Allow manipulation of system clock */
294*53ee8cc1Swenshuai.xi /* Allow irix_stime on mips */
295*53ee8cc1Swenshuai.xi /* Allow setting the real-time clock */
296*53ee8cc1Swenshuai.xi 
297*53ee8cc1Swenshuai.xi #define CAP_SYS_TIME         25
298*53ee8cc1Swenshuai.xi 
299*53ee8cc1Swenshuai.xi /* Allow configuration of tty devices */
300*53ee8cc1Swenshuai.xi /* Allow vhangup() of tty */
301*53ee8cc1Swenshuai.xi 
302*53ee8cc1Swenshuai.xi #define CAP_SYS_TTY_CONFIG   26
303*53ee8cc1Swenshuai.xi 
304*53ee8cc1Swenshuai.xi /* Allow the privileged aspects of mknod() */
305*53ee8cc1Swenshuai.xi 
306*53ee8cc1Swenshuai.xi #define CAP_MKNOD            27
307*53ee8cc1Swenshuai.xi 
308*53ee8cc1Swenshuai.xi /* Allow taking of leases on files */
309*53ee8cc1Swenshuai.xi 
310*53ee8cc1Swenshuai.xi #define CAP_LEASE            28
311*53ee8cc1Swenshuai.xi 
312*53ee8cc1Swenshuai.xi #define CAP_AUDIT_WRITE      29
313*53ee8cc1Swenshuai.xi 
314*53ee8cc1Swenshuai.xi #define CAP_AUDIT_CONTROL    30
315*53ee8cc1Swenshuai.xi 
316*53ee8cc1Swenshuai.xi #define CAP_SETFCAP	     31
317*53ee8cc1Swenshuai.xi 
318*53ee8cc1Swenshuai.xi /* Override MAC access.
319*53ee8cc1Swenshuai.xi    The base kernel enforces no MAC policy.
320*53ee8cc1Swenshuai.xi    An LSM may enforce a MAC policy, and if it does and it chooses
321*53ee8cc1Swenshuai.xi    to implement capability based overrides of that policy, this is
322*53ee8cc1Swenshuai.xi    the capability it should use to do so. */
323*53ee8cc1Swenshuai.xi 
324*53ee8cc1Swenshuai.xi #define CAP_MAC_OVERRIDE     32
325*53ee8cc1Swenshuai.xi 
326*53ee8cc1Swenshuai.xi /* Allow MAC configuration or state changes.
327*53ee8cc1Swenshuai.xi    The base kernel requires no MAC configuration.
328*53ee8cc1Swenshuai.xi    An LSM may enforce a MAC policy, and if it does and it chooses
329*53ee8cc1Swenshuai.xi    to implement capability based checks on modifications to that
330*53ee8cc1Swenshuai.xi    policy or the data required to maintain it, this is the
331*53ee8cc1Swenshuai.xi    capability it should use to do so. */
332*53ee8cc1Swenshuai.xi 
333*53ee8cc1Swenshuai.xi #define CAP_MAC_ADMIN        33
334*53ee8cc1Swenshuai.xi 
335*53ee8cc1Swenshuai.xi #define CAP_LAST_CAP         CAP_MAC_ADMIN
336*53ee8cc1Swenshuai.xi 
337*53ee8cc1Swenshuai.xi #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
338*53ee8cc1Swenshuai.xi 
339*53ee8cc1Swenshuai.xi /*
340*53ee8cc1Swenshuai.xi  * Bit location of each capability (used by user-space library and kernel)
341*53ee8cc1Swenshuai.xi  */
342*53ee8cc1Swenshuai.xi 
343*53ee8cc1Swenshuai.xi #define CAP_TO_INDEX(x)     ((x) >> 5)        /* 1 << 5 == bits in __u32 */
344*53ee8cc1Swenshuai.xi #define CAP_TO_MASK(x)      (1 << ((x) & 31)) /* mask for indexed __u32 */
345*53ee8cc1Swenshuai.xi 
346*53ee8cc1Swenshuai.xi 
347*53ee8cc1Swenshuai.xi #endif /* !_LINUX_CAPABILITY_H */
348