aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux/capability.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/uapi/linux/capability.h')
-rw-r--r--include/uapi/linux/capability.h358
1 files changed, 358 insertions, 0 deletions
diff --git a/include/uapi/linux/capability.h b/include/uapi/linux/capability.h
new file mode 100644
index 000000000000..ba478fa3012e
--- /dev/null
+++ b/include/uapi/linux/capability.h
@@ -0,0 +1,358 @@
1/*
2 * This is <linux/capability.h>
3 *
4 * Andrew G. Morgan <morgan@kernel.org>
5 * Alexander Kjeldaas <astor@guardian.no>
6 * with help from Aleph1, Roland Buresund and Andrew Main.
7 *
8 * See here for the libcap library ("POSIX draft" compliance):
9 *
10 * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
11 */
12
13#ifndef _UAPI_LINUX_CAPABILITY_H
14#define _UAPI_LINUX_CAPABILITY_H
15
16#include <linux/types.h>
17
18struct task_struct;
19
20/* User-level do most of the mapping between kernel and user
21 capabilities based on the version tag given by the kernel. The
22 kernel might be somewhat backwards compatible, but don't bet on
23 it. */
24
25/* Note, cap_t, is defined by POSIX (draft) to be an "opaque" pointer to
26 a set of three capability sets. The transposition of 3*the
27 following structure to such a composite is better handled in a user
28 library since the draft standard requires the use of malloc/free
29 etc.. */
30
31#define _LINUX_CAPABILITY_VERSION_1 0x19980330
32#define _LINUX_CAPABILITY_U32S_1 1
33
34#define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */
35#define _LINUX_CAPABILITY_U32S_2 2
36
37#define _LINUX_CAPABILITY_VERSION_3 0x20080522
38#define _LINUX_CAPABILITY_U32S_3 2
39
40typedef struct __user_cap_header_struct {
41 __u32 version;
42 int pid;
43} __user *cap_user_header_t;
44
45typedef struct __user_cap_data_struct {
46 __u32 effective;
47 __u32 permitted;
48 __u32 inheritable;
49} __user *cap_user_data_t;
50
51
52#define VFS_CAP_REVISION_MASK 0xFF000000
53#define VFS_CAP_REVISION_SHIFT 24
54#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
55#define VFS_CAP_FLAGS_EFFECTIVE 0x000001
56
57#define VFS_CAP_REVISION_1 0x01000000
58#define VFS_CAP_U32_1 1
59#define XATTR_CAPS_SZ_1 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1))
60
61#define VFS_CAP_REVISION_2 0x02000000
62#define VFS_CAP_U32_2 2
63#define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
64
65#define XATTR_CAPS_SZ XATTR_CAPS_SZ_2
66#define VFS_CAP_U32 VFS_CAP_U32_2
67#define VFS_CAP_REVISION VFS_CAP_REVISION_2
68
69struct vfs_cap_data {
70 __le32 magic_etc; /* Little endian */
71 struct {
72 __le32 permitted; /* Little endian */
73 __le32 inheritable; /* Little endian */
74 } data[VFS_CAP_U32];
75};
76
77#ifndef __KERNEL__
78
79/*
80 * Backwardly compatible definition for source code - trapped in a
81 * 32-bit world. If you find you need this, please consider using
82 * libcap to untrap yourself...
83 */
84#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1
85#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1
86
87#endif
88
89
90/**
91 ** POSIX-draft defined capabilities.
92 **/
93
94/* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this
95 overrides the restriction of changing file ownership and group
96 ownership. */
97
98#define CAP_CHOWN 0
99
100/* Override all DAC access, including ACL execute access if
101 [_POSIX_ACL] is defined. Excluding DAC access covered by
102 CAP_LINUX_IMMUTABLE. */
103
104#define CAP_DAC_OVERRIDE 1
105
106/* Overrides all DAC restrictions regarding read and search on files
107 and directories, including ACL restrictions if [_POSIX_ACL] is
108 defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */
109
110#define CAP_DAC_READ_SEARCH 2
111
112/* Overrides all restrictions about allowed operations on files, where
113 file owner ID must be equal to the user ID, except where CAP_FSETID
114 is applicable. It doesn't override MAC and DAC restrictions. */
115
116#define CAP_FOWNER 3
117
118/* Overrides the following restrictions that the effective user ID
119 shall match the file owner ID when setting the S_ISUID and S_ISGID
120 bits on that file; that the effective group ID (or one of the
121 supplementary group IDs) shall match the file owner ID when setting
122 the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are
123 cleared on successful return from chown(2) (not implemented). */
124
125#define CAP_FSETID 4
126
127/* Overrides the restriction that the real or effective user ID of a
128 process sending a signal must match the real or effective user ID
129 of the process receiving the signal. */
130
131#define CAP_KILL 5
132
133/* Allows setgid(2) manipulation */
134/* Allows setgroups(2) */
135/* Allows forged gids on socket credentials passing. */
136
137#define CAP_SETGID 6
138
139/* Allows set*uid(2) manipulation (including fsuid). */
140/* Allows forged pids on socket credentials passing. */
141
142#define CAP_SETUID 7
143
144
145/**
146 ** Linux-specific capabilities
147 **/
148
149/* Without VFS support for capabilities:
150 * Transfer any capability in your permitted set to any pid,
151 * remove any capability in your permitted set from any pid
152 * With VFS support for capabilities (neither of above, but)
153 * Add any capability from current's capability bounding set
154 * to the current process' inheritable set
155 * Allow taking bits out of capability bounding set
156 * Allow modification of the securebits for a process
157 */
158
159#define CAP_SETPCAP 8
160
161/* Allow modification of S_IMMUTABLE and S_APPEND file attributes */
162
163#define CAP_LINUX_IMMUTABLE 9
164
165/* Allows binding to TCP/UDP sockets below 1024 */
166/* Allows binding to ATM VCIs below 32 */
167
168#define CAP_NET_BIND_SERVICE 10
169
170/* Allow broadcasting, listen to multicast */
171
172#define CAP_NET_BROADCAST 11
173
174/* Allow interface configuration */
175/* Allow administration of IP firewall, masquerading and accounting */
176/* Allow setting debug option on sockets */
177/* Allow modification of routing tables */
178/* Allow setting arbitrary process / process group ownership on
179 sockets */
180/* Allow binding to any address for transparent proxying (also via NET_RAW) */
181/* Allow setting TOS (type of service) */
182/* Allow setting promiscuous mode */
183/* Allow clearing driver statistics */
184/* Allow multicasting */
185/* Allow read/write of device-specific registers */
186/* Allow activation of ATM control sockets */
187
188#define CAP_NET_ADMIN 12
189
190/* Allow use of RAW sockets */
191/* Allow use of PACKET sockets */
192/* Allow binding to any address for transparent proxying (also via NET_ADMIN) */
193
194#define CAP_NET_RAW 13
195
196/* Allow locking of shared memory segments */
197/* Allow mlock and mlockall (which doesn't really have anything to do