]>
git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blob - include/uapi/linux/capability.h
2 * This is <linux/capability.h>
4 * Andrew G. Morgan <morgan@kernel.org>
5 * Alexander Kjeldaas <astor@guardian.no>
6 * with help from Aleph1, Roland Buresund and Andrew Main.
8 * See here for the libcap library ("POSIX draft" compliance):
10 * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
13 #ifndef _UAPI_LINUX_CAPABILITY_H
14 #define _UAPI_LINUX_CAPABILITY_H
16 #include <linux/types.h>
18 /* User-level do most of the mapping between kernel and user
19 capabilities based on the version tag given by the kernel. The
20 kernel might be somewhat backwards compatible, but don't bet on
23 /* Note, cap_t, is defined by POSIX (draft) to be an "opaque" pointer to
24 a set of three capability sets. The transposition of 3*the
25 following structure to such a composite is better handled in a user
26 library since the draft standard requires the use of malloc/free
29 #define _LINUX_CAPABILITY_VERSION_1 0x19980330
30 #define _LINUX_CAPABILITY_U32S_1 1
32 #define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */
33 #define _LINUX_CAPABILITY_U32S_2 2
35 #define _LINUX_CAPABILITY_VERSION_3 0x20080522
36 #define _LINUX_CAPABILITY_U32S_3 2
38 typedef struct __user_cap_header_struct
{
41 } __user
*cap_user_header_t
;
43 typedef struct __user_cap_data_struct
{
47 } __user
*cap_user_data_t
;
50 #define VFS_CAP_REVISION_MASK 0xFF000000
51 #define VFS_CAP_REVISION_SHIFT 24
52 #define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
53 #define VFS_CAP_FLAGS_EFFECTIVE 0x000001
55 #define VFS_CAP_REVISION_1 0x01000000
56 #define VFS_CAP_U32_1 1
57 #define XATTR_CAPS_SZ_1 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1))
59 #define VFS_CAP_REVISION_2 0x02000000
60 #define VFS_CAP_U32_2 2
61 #define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
63 #define VFS_CAP_REVISION_3 0x03000000
64 #define VFS_CAP_U32_3 2
65 #define XATTR_CAPS_SZ_3 (sizeof(__le32)*(2 + 2*VFS_CAP_U32_3))
67 #define XATTR_CAPS_SZ XATTR_CAPS_SZ_3
68 #define VFS_CAP_U32 VFS_CAP_U32_3
69 #define VFS_CAP_REVISION VFS_CAP_REVISION_3
72 __le32 magic_etc
; /* Little endian */
74 __le32 permitted
; /* Little endian */
75 __le32 inheritable
; /* Little endian */
80 * same as vfs_cap_data but with a rootid at the end
82 struct vfs_ns_cap_data
{
85 __le32 permitted
; /* Little endian */
86 __le32 inheritable
; /* Little endian */
94 * Backwardly compatible definition for source code - trapped in a
95 * 32-bit world. If you find you need this, please consider using
96 * libcap to untrap yourself...
98 #define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1
99 #define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1
105 ** POSIX-draft defined capabilities.
108 /* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this
109 overrides the restriction of changing file ownership and group
114 /* Override all DAC access, including ACL execute access if
115 [_POSIX_ACL] is defined. Excluding DAC access covered by
116 CAP_LINUX_IMMUTABLE. */
118 #define CAP_DAC_OVERRIDE 1
120 /* Overrides all DAC restrictions regarding read and search on files
121 and directories, including ACL restrictions if [_POSIX_ACL] is
122 defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */
124 #define CAP_DAC_READ_SEARCH 2
126 /* Overrides all restrictions about allowed operations on files, where
127 file owner ID must be equal to the user ID, except where CAP_FSETID
128 is applicable. It doesn't override MAC and DAC restrictions. */
132 /* Overrides the following restrictions that the effective user ID
133 shall match the file owner ID when setting the S_ISUID and S_ISGID
134 bits on that file; that the effective group ID (or one of the
135 supplementary group IDs) shall match the file owner ID when setting
136 the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are
137 cleared on successful return from chown(2) (not implemented). */
141 /* Overrides the restriction that the real or effective user ID of a
142 process sending a signal must match the real or effective user ID
143 of the process receiving the signal. */
147 /* Allows setgid(2) manipulation */
148 /* Allows setgroups(2) */
149 /* Allows forged gids on socket credentials passing. */
153 /* Allows set*uid(2) manipulation (including fsuid). */
154 /* Allows forged pids on socket credentials passing. */
160 ** Linux-specific capabilities
163 /* Without VFS support for capabilities:
164 * Transfer any capability in your permitted set to any pid,
165 * remove any capability in your permitted set from any pid
166 * With VFS support for capabilities (neither of above, but)
167 * Add any capability from current's capability bounding set
168 * to the current process' inheritable set
169 * Allow taking bits out of capability bounding set
170 * Allow modification of the securebits for a process
173 #define CAP_SETPCAP 8
175 /* Allow modification of S_IMMUTABLE and S_APPEND file attributes */
177 #define CAP_LINUX_IMMUTABLE 9
179 /* Allows binding to TCP/UDP sockets below 1024 */
180 /* Allows binding to ATM VCIs below 32 */
182 #define CAP_NET_BIND_SERVICE 10
184 /* Allow broadcasting, listen to multicast */
186 #define CAP_NET_BROADCAST 11
188 /* Allow interface configuration */
189 /* Allow administration of IP firewall, masquerading and accounting */
190 /* Allow setting debug option on sockets */
191 /* Allow modification of routing tables */
192 /* Allow setting arbitrary process / process group ownership on
194 /* Allow binding to any address for transparent proxying (also via NET_RAW) */
195 /* Allow setting TOS (type of service) */
196 /* Allow setting promiscuous mode */
197 /* Allow clearing driver statistics */
198 /* Allow multicasting */
199 /* Allow read/write of device-specific registers */
200 /* Allow activation of ATM control sockets */
202 #define CAP_NET_ADMIN 12
204 /* Allow use of RAW sockets */
205 /* Allow use of PACKET sockets */
206 /* Allow binding to any address for transparent proxying (also via NET_ADMIN) */
208 #define CAP_NET_RAW 13
210 /* Allow locking of shared memory segments */
211 /* Allow mlock and mlockall (which doesn't really have anything to do
214 #define CAP_IPC_LOCK 14
216 /* Override IPC ownership checks */
218 #define CAP_IPC_OWNER 15
220 /* Insert and remove kernel modules - modify kernel without limit */
221 #define CAP_SYS_MODULE 16
223 /* Allow ioperm/iopl access */
224 /* Allow sending USB messages to any device via /dev/bus/usb */
226 #define CAP_SYS_RAWIO 17
228 /* Allow use of chroot() */
230 #define CAP_SYS_CHROOT 18
232 /* Allow ptrace() of any process */
234 #define CAP_SYS_PTRACE 19
236 /* Allow configuration of process accounting */
238 #define CAP_SYS_PACCT 20
240 /* Allow configuration of the secure attention key */
241 /* Allow administration of the random device */
242 /* Allow examination and configuration of disk quotas */
243 /* Allow setting the domainname */
244 /* Allow setting the hostname */
245 /* Allow calling bdflush() */
246 /* Allow mount() and umount(), setting up new smb connection */
247 /* Allow some autofs root ioctls */
248 /* Allow nfsservctl */
249 /* Allow VM86_REQUEST_IRQ */
250 /* Allow to read/write pci config on alpha */
251 /* Allow irix_prctl on mips (setstacksize) */
252 /* Allow flushing all cache on m68k (sys_cacheflush) */
253 /* Allow removing semaphores */
254 /* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores
256 /* Allow locking/unlocking of shared memory segment */
257 /* Allow turning swap on/off */
258 /* Allow forged pids on socket credentials passing */
259 /* Allow setting readahead and flushing buffers on block devices */
260 /* Allow setting geometry in floppy driver */
261 /* Allow turning DMA on/off in xd driver */
262 /* Allow administration of md devices (mostly the above, but some
264 /* Allow tuning the ide driver */
265 /* Allow access to the nvram device */
266 /* Allow administration of apm_bios, serial and bttv (TV) device */
267 /* Allow manufacturer commands in isdn CAPI support driver */
268 /* Allow reading non-standardized portions of pci configuration space */
269 /* Allow DDI debug ioctl on sbpcd driver */
270 /* Allow setting up serial ports */
271 /* Allow sending raw qic-117 commands */
272 /* Allow enabling/disabling tagged queuing on SCSI controllers and sending
273 arbitrary SCSI commands */
274 /* Allow setting encryption key on loopback filesystem */
275 /* Allow setting zone reclaim policy */
277 #define CAP_SYS_ADMIN 21
279 /* Allow use of reboot() */
281 #define CAP_SYS_BOOT 22
283 /* Allow raising priority and setting priority on other (different
285 /* Allow use of FIFO and round-robin (realtime) scheduling on own
286 processes and setting the scheduling algorithm used by another
288 /* Allow setting cpu affinity on other processes */
290 #define CAP_SYS_NICE 23
292 /* Override resource limits. Set resource limits. */
293 /* Override quota limits. */
294 /* Override reserved space on ext2 filesystem */
295 /* Modify data journaling mode on ext3 filesystem (uses journaling
297 /* NOTE: ext2 honors fsuid when checking for resource overrides, so
298 you can override using fsuid too */
299 /* Override size restrictions on IPC message queues */
300 /* Allow more than 64hz interrupts from the real-time clock */
301 /* Override max number of consoles on console allocation */
302 /* Override max number of keymaps */
304 #define CAP_SYS_RESOURCE 24
306 /* Allow manipulation of system clock */
307 /* Allow irix_stime on mips */
308 /* Allow setting the real-time clock */
310 #define CAP_SYS_TIME 25
312 /* Allow configuration of tty devices */
313 /* Allow vhangup() of tty */
315 #define CAP_SYS_TTY_CONFIG 26
317 /* Allow the privileged aspects of mknod() */
321 /* Allow taking of leases on files */
325 /* Allow writing the audit log via unicast netlink socket */
327 #define CAP_AUDIT_WRITE 29
329 /* Allow configuration of audit via unicast netlink socket */
331 #define CAP_AUDIT_CONTROL 30
333 #define CAP_SETFCAP 31
335 /* Override MAC access.
336 The base kernel enforces no MAC policy.
337 An LSM may enforce a MAC policy, and if it does and it chooses
338 to implement capability based overrides of that policy, this is
339 the capability it should use to do so. */
341 #define CAP_MAC_OVERRIDE 32
343 /* Allow MAC configuration or state changes.
344 The base kernel requires no MAC configuration.
345 An LSM may enforce a MAC policy, and if it does and it chooses
346 to implement capability based checks on modifications to that
347 policy or the data required to maintain it, this is the
348 capability it should use to do so. */
350 #define CAP_MAC_ADMIN 33
352 /* Allow configuring the kernel's syslog (printk behaviour) */
354 #define CAP_SYSLOG 34
356 /* Allow triggering something that will wake the system */
358 #define CAP_WAKE_ALARM 35
360 /* Allow preventing system suspends */
362 #define CAP_BLOCK_SUSPEND 36
364 /* Allow reading the audit log via multicast netlink socket */
366 #define CAP_AUDIT_READ 37
369 #define CAP_LAST_CAP CAP_AUDIT_READ
371 #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
374 * Bit location of each capability (used by user-space library and kernel)
377 #define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */
378 #define CAP_TO_MASK(x) (1 << ((x) & 31)) /* mask for indexed __u32 */
381 #endif /* _UAPI_LINUX_CAPABILITY_H */