1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * This is <linux/capability.h> 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Andrew G. Morgan <morgan@kernel.org> 6*4882a593Smuzhiyun * Alexander Kjeldaas <astor@guardian.no> 7*4882a593Smuzhiyun * with help from Aleph1, Roland Buresund and Andrew Main. 8*4882a593Smuzhiyun * 9*4882a593Smuzhiyun * See here for the libcap library ("POSIX draft" compliance): 10*4882a593Smuzhiyun * 11*4882a593Smuzhiyun * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/ 12*4882a593Smuzhiyun */ 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun #ifndef _UAPI_LINUX_CAPABILITY_H 15*4882a593Smuzhiyun #define _UAPI_LINUX_CAPABILITY_H 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun #include <linux/types.h> 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun /* User-level do most of the mapping between kernel and user 20*4882a593Smuzhiyun capabilities based on the version tag given by the kernel. The 21*4882a593Smuzhiyun kernel might be somewhat backwards compatible, but don't bet on 22*4882a593Smuzhiyun it. */ 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun /* Note, cap_t, is defined by POSIX (draft) to be an "opaque" pointer to 25*4882a593Smuzhiyun a set of three capability sets. The transposition of 3*the 26*4882a593Smuzhiyun following structure to such a composite is better handled in a user 27*4882a593Smuzhiyun library since the draft standard requires the use of malloc/free 28*4882a593Smuzhiyun etc.. */ 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun #define _LINUX_CAPABILITY_VERSION_1 0x19980330 31*4882a593Smuzhiyun #define _LINUX_CAPABILITY_U32S_1 1 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun #define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */ 34*4882a593Smuzhiyun #define _LINUX_CAPABILITY_U32S_2 2 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun #define _LINUX_CAPABILITY_VERSION_3 0x20080522 37*4882a593Smuzhiyun #define _LINUX_CAPABILITY_U32S_3 2 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun typedef struct __user_cap_header_struct { 40*4882a593Smuzhiyun __u32 version; 41*4882a593Smuzhiyun int pid; 42*4882a593Smuzhiyun } __user *cap_user_header_t; 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun typedef struct __user_cap_data_struct { 45*4882a593Smuzhiyun __u32 effective; 46*4882a593Smuzhiyun __u32 permitted; 47*4882a593Smuzhiyun __u32 inheritable; 48*4882a593Smuzhiyun } __user *cap_user_data_t; 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun #define VFS_CAP_REVISION_MASK 0xFF000000 52*4882a593Smuzhiyun #define VFS_CAP_REVISION_SHIFT 24 53*4882a593Smuzhiyun #define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK 54*4882a593Smuzhiyun #define VFS_CAP_FLAGS_EFFECTIVE 0x000001 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun #define VFS_CAP_REVISION_1 0x01000000 57*4882a593Smuzhiyun #define VFS_CAP_U32_1 1 58*4882a593Smuzhiyun #define XATTR_CAPS_SZ_1 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1)) 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun #define VFS_CAP_REVISION_2 0x02000000 61*4882a593Smuzhiyun #define VFS_CAP_U32_2 2 62*4882a593Smuzhiyun #define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2)) 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun #define VFS_CAP_REVISION_3 0x03000000 65*4882a593Smuzhiyun #define VFS_CAP_U32_3 2 66*4882a593Smuzhiyun #define XATTR_CAPS_SZ_3 (sizeof(__le32)*(2 + 2*VFS_CAP_U32_3)) 67*4882a593Smuzhiyun 68*4882a593Smuzhiyun #define XATTR_CAPS_SZ XATTR_CAPS_SZ_3 69*4882a593Smuzhiyun #define VFS_CAP_U32 VFS_CAP_U32_3 70*4882a593Smuzhiyun #define VFS_CAP_REVISION VFS_CAP_REVISION_3 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun struct vfs_cap_data { 73*4882a593Smuzhiyun __le32 magic_etc; /* Little endian */ 74*4882a593Smuzhiyun struct { 75*4882a593Smuzhiyun __le32 permitted; /* Little endian */ 76*4882a593Smuzhiyun __le32 inheritable; /* Little endian */ 77*4882a593Smuzhiyun } data[VFS_CAP_U32]; 78*4882a593Smuzhiyun }; 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun /* 81*4882a593Smuzhiyun * same as vfs_cap_data but with a rootid at the end 82*4882a593Smuzhiyun */ 83*4882a593Smuzhiyun struct vfs_ns_cap_data { 84*4882a593Smuzhiyun __le32 magic_etc; 85*4882a593Smuzhiyun struct { 86*4882a593Smuzhiyun __le32 permitted; /* Little endian */ 87*4882a593Smuzhiyun __le32 inheritable; /* Little endian */ 88*4882a593Smuzhiyun } data[VFS_CAP_U32]; 89*4882a593Smuzhiyun __le32 rootid; 90*4882a593Smuzhiyun }; 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun #ifndef __KERNEL__ 93*4882a593Smuzhiyun 94*4882a593Smuzhiyun /* 95*4882a593Smuzhiyun * Backwardly compatible definition for source code - trapped in a 96*4882a593Smuzhiyun * 32-bit world. If you find you need this, please consider using 97*4882a593Smuzhiyun * libcap to untrap yourself... 98*4882a593Smuzhiyun */ 99*4882a593Smuzhiyun #define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1 100*4882a593Smuzhiyun #define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1 101*4882a593Smuzhiyun 102*4882a593Smuzhiyun #endif 103*4882a593Smuzhiyun 104*4882a593Smuzhiyun 105*4882a593Smuzhiyun /** 106*4882a593Smuzhiyun ** POSIX-draft defined capabilities. 107*4882a593Smuzhiyun **/ 108*4882a593Smuzhiyun 109*4882a593Smuzhiyun /* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this 110*4882a593Smuzhiyun overrides the restriction of changing file ownership and group 111*4882a593Smuzhiyun ownership. */ 112*4882a593Smuzhiyun 113*4882a593Smuzhiyun #define CAP_CHOWN 0 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun /* Override all DAC access, including ACL execute access if 116*4882a593Smuzhiyun [_POSIX_ACL] is defined. Excluding DAC access covered by 117*4882a593Smuzhiyun CAP_LINUX_IMMUTABLE. */ 118*4882a593Smuzhiyun 119*4882a593Smuzhiyun #define CAP_DAC_OVERRIDE 1 120*4882a593Smuzhiyun 121*4882a593Smuzhiyun /* Overrides all DAC restrictions regarding read and search on files 122*4882a593Smuzhiyun and directories, including ACL restrictions if [_POSIX_ACL] is 123*4882a593Smuzhiyun defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */ 124*4882a593Smuzhiyun 125*4882a593Smuzhiyun #define CAP_DAC_READ_SEARCH 2 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun /* Overrides all restrictions about allowed operations on files, where 128*4882a593Smuzhiyun file owner ID must be equal to the user ID, except where CAP_FSETID 129*4882a593Smuzhiyun is applicable. It doesn't override MAC and DAC restrictions. */ 130*4882a593Smuzhiyun 131*4882a593Smuzhiyun #define CAP_FOWNER 3 132*4882a593Smuzhiyun 133*4882a593Smuzhiyun /* Overrides the following restrictions that the effective user ID 134*4882a593Smuzhiyun shall match the file owner ID when setting the S_ISUID and S_ISGID 135*4882a593Smuzhiyun bits on that file; that the effective group ID (or one of the 136*4882a593Smuzhiyun supplementary group IDs) shall match the file owner ID when setting 137*4882a593Smuzhiyun the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are 138*4882a593Smuzhiyun cleared on successful return from chown(2) (not implemented). */ 139*4882a593Smuzhiyun 140*4882a593Smuzhiyun #define CAP_FSETID 4 141*4882a593Smuzhiyun 142*4882a593Smuzhiyun /* Overrides the restriction that the real or effective user ID of a 143*4882a593Smuzhiyun process sending a signal must match the real or effective user ID 144*4882a593Smuzhiyun of the process receiving the signal. */ 145*4882a593Smuzhiyun 146*4882a593Smuzhiyun #define CAP_KILL 5 147*4882a593Smuzhiyun 148*4882a593Smuzhiyun /* Allows setgid(2) manipulation */ 149*4882a593Smuzhiyun /* Allows setgroups(2) */ 150*4882a593Smuzhiyun /* Allows forged gids on socket credentials passing. */ 151*4882a593Smuzhiyun 152*4882a593Smuzhiyun #define CAP_SETGID 6 153*4882a593Smuzhiyun 154*4882a593Smuzhiyun /* Allows set*uid(2) manipulation (including fsuid). */ 155*4882a593Smuzhiyun /* Allows forged pids on socket credentials passing. */ 156*4882a593Smuzhiyun 157*4882a593Smuzhiyun #define CAP_SETUID 7 158*4882a593Smuzhiyun 159*4882a593Smuzhiyun 160*4882a593Smuzhiyun /** 161*4882a593Smuzhiyun ** Linux-specific capabilities 162*4882a593Smuzhiyun **/ 163*4882a593Smuzhiyun 164*4882a593Smuzhiyun /* Without VFS support for capabilities: 165*4882a593Smuzhiyun * Transfer any capability in your permitted set to any pid, 166*4882a593Smuzhiyun * remove any capability in your permitted set from any pid 167*4882a593Smuzhiyun * With VFS support for capabilities (neither of above, but) 168*4882a593Smuzhiyun * Add any capability from current's capability bounding set 169*4882a593Smuzhiyun * to the current process' inheritable set 170*4882a593Smuzhiyun * Allow taking bits out of capability bounding set 171*4882a593Smuzhiyun * Allow modification of the securebits for a process 172*4882a593Smuzhiyun */ 173*4882a593Smuzhiyun 174*4882a593Smuzhiyun #define CAP_SETPCAP 8 175*4882a593Smuzhiyun 176*4882a593Smuzhiyun /* Allow modification of S_IMMUTABLE and S_APPEND file attributes */ 177*4882a593Smuzhiyun 178*4882a593Smuzhiyun #define CAP_LINUX_IMMUTABLE 9 179*4882a593Smuzhiyun 180*4882a593Smuzhiyun /* Allows binding to TCP/UDP sockets below 1024 */ 181*4882a593Smuzhiyun /* Allows binding to ATM VCIs below 32 */ 182*4882a593Smuzhiyun 183*4882a593Smuzhiyun #define CAP_NET_BIND_SERVICE 10 184*4882a593Smuzhiyun 185*4882a593Smuzhiyun /* Allow broadcasting, listen to multicast */ 186*4882a593Smuzhiyun 187*4882a593Smuzhiyun #define CAP_NET_BROADCAST 11 188*4882a593Smuzhiyun 189*4882a593Smuzhiyun /* Allow interface configuration */ 190*4882a593Smuzhiyun /* Allow administration of IP firewall, masquerading and accounting */ 191*4882a593Smuzhiyun /* Allow setting debug option on sockets */ 192*4882a593Smuzhiyun /* Allow modification of routing tables */ 193*4882a593Smuzhiyun /* Allow setting arbitrary process / process group ownership on 194*4882a593Smuzhiyun sockets */ 195*4882a593Smuzhiyun /* Allow binding to any address for transparent proxying (also via NET_RAW) */ 196*4882a593Smuzhiyun /* Allow setting TOS (type of service) */ 197*4882a593Smuzhiyun /* Allow setting promiscuous mode */ 198*4882a593Smuzhiyun /* Allow clearing driver statistics */ 199*4882a593Smuzhiyun /* Allow multicasting */ 200*4882a593Smuzhiyun /* Allow read/write of device-specific registers */ 201*4882a593Smuzhiyun /* Allow activation of ATM control sockets */ 202*4882a593Smuzhiyun 203*4882a593Smuzhiyun #define CAP_NET_ADMIN 12 204*4882a593Smuzhiyun 205*4882a593Smuzhiyun /* Allow use of RAW sockets */ 206*4882a593Smuzhiyun /* Allow use of PACKET sockets */ 207*4882a593Smuzhiyun /* Allow binding to any address for transparent proxying (also via NET_ADMIN) */ 208*4882a593Smuzhiyun 209*4882a593Smuzhiyun #define CAP_NET_RAW 13 210*4882a593Smuzhiyun 211*4882a593Smuzhiyun /* Allow locking of shared memory segments */ 212*4882a593Smuzhiyun /* Allow mlock and mlockall (which doesn't really have anything to do 213*4882a593Smuzhiyun with IPC) */ 214*4882a593Smuzhiyun 215*4882a593Smuzhiyun #define CAP_IPC_LOCK 14 216*4882a593Smuzhiyun 217*4882a593Smuzhiyun /* Override IPC ownership checks */ 218*4882a593Smuzhiyun 219*4882a593Smuzhiyun #define CAP_IPC_OWNER 15 220*4882a593Smuzhiyun 221*4882a593Smuzhiyun /* Insert and remove kernel modules - modify kernel without limit */ 222*4882a593Smuzhiyun #define CAP_SYS_MODULE 16 223*4882a593Smuzhiyun 224*4882a593Smuzhiyun /* Allow ioperm/iopl access */ 225*4882a593Smuzhiyun /* Allow sending USB messages to any device via /dev/bus/usb */ 226*4882a593Smuzhiyun 227*4882a593Smuzhiyun #define CAP_SYS_RAWIO 17 228*4882a593Smuzhiyun 229*4882a593Smuzhiyun /* Allow use of chroot() */ 230*4882a593Smuzhiyun 231*4882a593Smuzhiyun #define CAP_SYS_CHROOT 18 232*4882a593Smuzhiyun 233*4882a593Smuzhiyun /* Allow ptrace() of any process */ 234*4882a593Smuzhiyun 235*4882a593Smuzhiyun #define CAP_SYS_PTRACE 19 236*4882a593Smuzhiyun 237*4882a593Smuzhiyun /* Allow configuration of process accounting */ 238*4882a593Smuzhiyun 239*4882a593Smuzhiyun #define CAP_SYS_PACCT 20 240*4882a593Smuzhiyun 241*4882a593Smuzhiyun /* Allow configuration of the secure attention key */ 242*4882a593Smuzhiyun /* Allow administration of the random device */ 243*4882a593Smuzhiyun /* Allow examination and configuration of disk quotas */ 244*4882a593Smuzhiyun /* Allow setting the domainname */ 245*4882a593Smuzhiyun /* Allow setting the hostname */ 246*4882a593Smuzhiyun /* Allow calling bdflush() */ 247*4882a593Smuzhiyun /* Allow mount() and umount(), setting up new smb connection */ 248*4882a593Smuzhiyun /* Allow some autofs root ioctls */ 249*4882a593Smuzhiyun /* Allow nfsservctl */ 250*4882a593Smuzhiyun /* Allow VM86_REQUEST_IRQ */ 251*4882a593Smuzhiyun /* Allow to read/write pci config on alpha */ 252*4882a593Smuzhiyun /* Allow irix_prctl on mips (setstacksize) */ 253*4882a593Smuzhiyun /* Allow flushing all cache on m68k (sys_cacheflush) */ 254*4882a593Smuzhiyun /* Allow removing semaphores */ 255*4882a593Smuzhiyun /* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores 256*4882a593Smuzhiyun and shared memory */ 257*4882a593Smuzhiyun /* Allow locking/unlocking of shared memory segment */ 258*4882a593Smuzhiyun /* Allow turning swap on/off */ 259*4882a593Smuzhiyun /* Allow forged pids on socket credentials passing */ 260*4882a593Smuzhiyun /* Allow setting readahead and flushing buffers on block devices */ 261*4882a593Smuzhiyun /* Allow setting geometry in floppy driver */ 262*4882a593Smuzhiyun /* Allow turning DMA on/off in xd driver */ 263*4882a593Smuzhiyun /* Allow administration of md devices (mostly the above, but some 264*4882a593Smuzhiyun extra ioctls) */ 265*4882a593Smuzhiyun /* Allow tuning the ide driver */ 266*4882a593Smuzhiyun /* Allow access to the nvram device */ 267*4882a593Smuzhiyun /* Allow administration of apm_bios, serial and bttv (TV) device */ 268*4882a593Smuzhiyun /* Allow manufacturer commands in isdn CAPI support driver */ 269*4882a593Smuzhiyun /* Allow reading non-standardized portions of pci configuration space */ 270*4882a593Smuzhiyun /* Allow DDI debug ioctl on sbpcd driver */ 271*4882a593Smuzhiyun /* Allow setting up serial ports */ 272*4882a593Smuzhiyun /* Allow sending raw qic-117 commands */ 273*4882a593Smuzhiyun /* Allow enabling/disabling tagged queuing on SCSI controllers and sending 274*4882a593Smuzhiyun arbitrary SCSI commands */ 275*4882a593Smuzhiyun /* Allow setting encryption key on loopback filesystem */ 276*4882a593Smuzhiyun /* Allow setting zone reclaim policy */ 277*4882a593Smuzhiyun /* Allow everything under CAP_BPF and CAP_PERFMON for backward compatibility */ 278*4882a593Smuzhiyun 279*4882a593Smuzhiyun #define CAP_SYS_ADMIN 21 280*4882a593Smuzhiyun 281*4882a593Smuzhiyun /* Allow use of reboot() */ 282*4882a593Smuzhiyun 283*4882a593Smuzhiyun #define CAP_SYS_BOOT 22 284*4882a593Smuzhiyun 285*4882a593Smuzhiyun /* Allow raising priority and setting priority on other (different 286*4882a593Smuzhiyun UID) processes */ 287*4882a593Smuzhiyun /* Allow use of FIFO and round-robin (realtime) scheduling on own 288*4882a593Smuzhiyun processes and setting the scheduling algorithm used by another 289*4882a593Smuzhiyun process. */ 290*4882a593Smuzhiyun /* Allow setting cpu affinity on other processes */ 291*4882a593Smuzhiyun 292*4882a593Smuzhiyun #define CAP_SYS_NICE 23 293*4882a593Smuzhiyun 294*4882a593Smuzhiyun /* Override resource limits. Set resource limits. */ 295*4882a593Smuzhiyun /* Override quota limits. */ 296*4882a593Smuzhiyun /* Override reserved space on ext2 filesystem */ 297*4882a593Smuzhiyun /* Modify data journaling mode on ext3 filesystem (uses journaling 298*4882a593Smuzhiyun resources) */ 299*4882a593Smuzhiyun /* NOTE: ext2 honors fsuid when checking for resource overrides, so 300*4882a593Smuzhiyun you can override using fsuid too */ 301*4882a593Smuzhiyun /* Override size restrictions on IPC message queues */ 302*4882a593Smuzhiyun /* Allow more than 64hz interrupts from the real-time clock */ 303*4882a593Smuzhiyun /* Override max number of consoles on console allocation */ 304*4882a593Smuzhiyun /* Override max number of keymaps */ 305*4882a593Smuzhiyun /* Control memory reclaim behavior */ 306*4882a593Smuzhiyun 307*4882a593Smuzhiyun #define CAP_SYS_RESOURCE 24 308*4882a593Smuzhiyun 309*4882a593Smuzhiyun /* Allow manipulation of system clock */ 310*4882a593Smuzhiyun /* Allow irix_stime on mips */ 311*4882a593Smuzhiyun /* Allow setting the real-time clock */ 312*4882a593Smuzhiyun 313*4882a593Smuzhiyun #define CAP_SYS_TIME 25 314*4882a593Smuzhiyun 315*4882a593Smuzhiyun /* Allow configuration of tty devices */ 316*4882a593Smuzhiyun /* Allow vhangup() of tty */ 317*4882a593Smuzhiyun 318*4882a593Smuzhiyun #define CAP_SYS_TTY_CONFIG 26 319*4882a593Smuzhiyun 320*4882a593Smuzhiyun /* Allow the privileged aspects of mknod() */ 321*4882a593Smuzhiyun 322*4882a593Smuzhiyun #define CAP_MKNOD 27 323*4882a593Smuzhiyun 324*4882a593Smuzhiyun /* Allow taking of leases on files */ 325*4882a593Smuzhiyun 326*4882a593Smuzhiyun #define CAP_LEASE 28 327*4882a593Smuzhiyun 328*4882a593Smuzhiyun /* Allow writing the audit log via unicast netlink socket */ 329*4882a593Smuzhiyun 330*4882a593Smuzhiyun #define CAP_AUDIT_WRITE 29 331*4882a593Smuzhiyun 332*4882a593Smuzhiyun /* Allow configuration of audit via unicast netlink socket */ 333*4882a593Smuzhiyun 334*4882a593Smuzhiyun #define CAP_AUDIT_CONTROL 30 335*4882a593Smuzhiyun 336*4882a593Smuzhiyun /* Set or remove capabilities on files. 337*4882a593Smuzhiyun Map uid=0 into a child user namespace. */ 338*4882a593Smuzhiyun 339*4882a593Smuzhiyun #define CAP_SETFCAP 31 340*4882a593Smuzhiyun 341*4882a593Smuzhiyun /* Override MAC access. 342*4882a593Smuzhiyun The base kernel enforces no MAC policy. 343*4882a593Smuzhiyun An LSM may enforce a MAC policy, and if it does and it chooses 344*4882a593Smuzhiyun to implement capability based overrides of that policy, this is 345*4882a593Smuzhiyun the capability it should use to do so. */ 346*4882a593Smuzhiyun 347*4882a593Smuzhiyun #define CAP_MAC_OVERRIDE 32 348*4882a593Smuzhiyun 349*4882a593Smuzhiyun /* Allow MAC configuration or state changes. 350*4882a593Smuzhiyun The base kernel requires no MAC configuration. 351*4882a593Smuzhiyun An LSM may enforce a MAC policy, and if it does and it chooses 352*4882a593Smuzhiyun to implement capability based checks on modifications to that 353*4882a593Smuzhiyun policy or the data required to maintain it, this is the 354*4882a593Smuzhiyun capability it should use to do so. */ 355*4882a593Smuzhiyun 356*4882a593Smuzhiyun #define CAP_MAC_ADMIN 33 357*4882a593Smuzhiyun 358*4882a593Smuzhiyun /* Allow configuring the kernel's syslog (printk behaviour) */ 359*4882a593Smuzhiyun 360*4882a593Smuzhiyun #define CAP_SYSLOG 34 361*4882a593Smuzhiyun 362*4882a593Smuzhiyun /* Allow triggering something that will wake the system */ 363*4882a593Smuzhiyun 364*4882a593Smuzhiyun #define CAP_WAKE_ALARM 35 365*4882a593Smuzhiyun 366*4882a593Smuzhiyun /* Allow preventing system suspends */ 367*4882a593Smuzhiyun 368*4882a593Smuzhiyun #define CAP_BLOCK_SUSPEND 36 369*4882a593Smuzhiyun 370*4882a593Smuzhiyun /* Allow reading the audit log via multicast netlink socket */ 371*4882a593Smuzhiyun 372*4882a593Smuzhiyun #define CAP_AUDIT_READ 37 373*4882a593Smuzhiyun 374*4882a593Smuzhiyun /* 375*4882a593Smuzhiyun * Allow system performance and observability privileged operations 376*4882a593Smuzhiyun * using perf_events, i915_perf and other kernel subsystems 377*4882a593Smuzhiyun */ 378*4882a593Smuzhiyun 379*4882a593Smuzhiyun #define CAP_PERFMON 38 380*4882a593Smuzhiyun 381*4882a593Smuzhiyun /* 382*4882a593Smuzhiyun * CAP_BPF allows the following BPF operations: 383*4882a593Smuzhiyun * - Creating all types of BPF maps 384*4882a593Smuzhiyun * - Advanced verifier features 385*4882a593Smuzhiyun * - Indirect variable access 386*4882a593Smuzhiyun * - Bounded loops 387*4882a593Smuzhiyun * - BPF to BPF function calls 388*4882a593Smuzhiyun * - Scalar precision tracking 389*4882a593Smuzhiyun * - Larger complexity limits 390*4882a593Smuzhiyun * - Dead code elimination 391*4882a593Smuzhiyun * - And potentially other features 392*4882a593Smuzhiyun * - Loading BPF Type Format (BTF) data 393*4882a593Smuzhiyun * - Retrieve xlated and JITed code of BPF programs 394*4882a593Smuzhiyun * - Use bpf_spin_lock() helper 395*4882a593Smuzhiyun * 396*4882a593Smuzhiyun * CAP_PERFMON relaxes the verifier checks further: 397*4882a593Smuzhiyun * - BPF progs can use of pointer-to-integer conversions 398*4882a593Smuzhiyun * - speculation attack hardening measures are bypassed 399*4882a593Smuzhiyun * - bpf_probe_read to read arbitrary kernel memory is allowed 400*4882a593Smuzhiyun * - bpf_trace_printk to print kernel memory is allowed 401*4882a593Smuzhiyun * 402*4882a593Smuzhiyun * CAP_SYS_ADMIN is required to use bpf_probe_write_user. 403*4882a593Smuzhiyun * 404*4882a593Smuzhiyun * CAP_SYS_ADMIN is required to iterate system wide loaded 405*4882a593Smuzhiyun * programs, maps, links, BTFs and convert their IDs to file descriptors. 406*4882a593Smuzhiyun * 407*4882a593Smuzhiyun * CAP_PERFMON and CAP_BPF are required to load tracing programs. 408*4882a593Smuzhiyun * CAP_NET_ADMIN and CAP_BPF are required to load networking programs. 409*4882a593Smuzhiyun */ 410*4882a593Smuzhiyun #define CAP_BPF 39 411*4882a593Smuzhiyun 412*4882a593Smuzhiyun 413*4882a593Smuzhiyun /* Allow checkpoint/restore related operations */ 414*4882a593Smuzhiyun /* Allow PID selection during clone3() */ 415*4882a593Smuzhiyun /* Allow writing to ns_last_pid */ 416*4882a593Smuzhiyun 417*4882a593Smuzhiyun #define CAP_CHECKPOINT_RESTORE 40 418*4882a593Smuzhiyun 419*4882a593Smuzhiyun #define CAP_LAST_CAP CAP_CHECKPOINT_RESTORE 420*4882a593Smuzhiyun 421*4882a593Smuzhiyun #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) 422*4882a593Smuzhiyun 423*4882a593Smuzhiyun /* 424*4882a593Smuzhiyun * Bit location of each capability (used by user-space library and kernel) 425*4882a593Smuzhiyun */ 426*4882a593Smuzhiyun 427*4882a593Smuzhiyun #define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */ 428*4882a593Smuzhiyun #define CAP_TO_MASK(x) (1U << ((x) & 31)) /* mask for indexed __u32 */ 429*4882a593Smuzhiyun 430*4882a593Smuzhiyun 431*4882a593Smuzhiyun #endif /* _UAPI_LINUX_CAPABILITY_H */ 432