1 /* SPDX-License-Identifier: GPL-2.0 */
2 #include <linux/capability.h>
4 #define COMMON_FILE_SOCK_PERMS "ioctl", "read", "write", "create", \
5 "getattr", "setattr", "lock", "relabelfrom", "relabelto", "append", "map"
7 #define COMMON_FILE_PERMS COMMON_FILE_SOCK_PERMS, "unlink", "link", \
8 "rename", "execute", "quotaon", "mounton", "audit_access", \
11 #define COMMON_SOCK_PERMS COMMON_FILE_SOCK_PERMS, "bind", "connect", \
12 "listen", "accept", "getopt", "setopt", "shutdown", "recvfrom", \
15 #define COMMON_IPC_PERMS "create", "destroy", "getattr", "setattr", "read", \
16 "write", "associate", "unix_read", "unix_write"
18 #define COMMON_CAP_PERMS "chown", "dac_override", "dac_read_search", \
19 "fowner", "fsetid", "kill", "setgid", "setuid", "setpcap", \
20 "linux_immutable", "net_bind_service", "net_broadcast", \
21 "net_admin", "net_raw", "ipc_lock", "ipc_owner", "sys_module", \
22 "sys_rawio", "sys_chroot", "sys_ptrace", "sys_pacct", "sys_admin", \
23 "sys_boot", "sys_nice", "sys_resource", "sys_time", \
24 "sys_tty_config", "mknod", "lease", "audit_write", \
25 "audit_control", "setfcap"
27 #define COMMON_CAP2_PERMS "mac_override", "mac_admin", "syslog", \
28 "wake_alarm", "block_suspend", "audit_read"
30 #if CAP_LAST_CAP > CAP_AUDIT_READ
31 #error New capability defined, please update COMMON_CAP2_PERMS.
35 * Note: The name for any socket class should be suffixed by "socket",
36 * and doesn't contain more than one substr of "socket".
38 struct security_class_mapping secclass_map
[] = {
40 { "compute_av", "compute_create", "compute_member",
41 "check_context", "load_policy", "compute_relabel",
42 "compute_user", "setenforce", "setbool", "setsecparam",
43 "setcheckreqprot", "read_policy", "validate_trans", NULL
} },
45 { "fork", "transition", "sigchld", "sigkill",
46 "sigstop", "signull", "signal", "ptrace", "getsched", "setsched",
47 "getsession", "getpgid", "setpgid", "getcap", "setcap", "share",
48 "getattr", "setexec", "setfscreate", "noatsecure", "siginh",
49 "setrlimit", "rlimitinh", "dyntransition", "setcurrent",
50 "execmem", "execstack", "execheap", "setkeycreate",
51 "setsockcreate", "getrlimit", NULL
} },
53 { "nnp_transition", "nosuid_transition", NULL
} },
55 { "ipc_info", "syslog_read", "syslog_mod",
56 "syslog_console", "module_request", "module_load", NULL
} },
58 { COMMON_CAP_PERMS
, NULL
} },
60 { "mount", "remount", "unmount", "getattr",
61 "relabelfrom", "relabelto", "associate", "quotamod",
65 "execute_no_trans", "entrypoint", NULL
} },
67 { COMMON_FILE_PERMS
, "add_name", "remove_name",
68 "reparent", "search", "rmdir", NULL
} },
69 { "fd", { "use", NULL
} },
71 { COMMON_FILE_PERMS
, NULL
} },
73 { COMMON_FILE_PERMS
, NULL
} },
75 { COMMON_FILE_PERMS
, NULL
} },
77 { COMMON_FILE_PERMS
, NULL
} },
79 { COMMON_FILE_PERMS
, NULL
} },
81 { COMMON_SOCK_PERMS
, NULL
} },
84 "node_bind", "name_connect",
88 "node_bind", NULL
} },
91 "node_bind", NULL
} },
93 { "recvfrom", "sendto", NULL
} },
95 { "ingress", "egress", NULL
} },
97 { COMMON_SOCK_PERMS
, NULL
} },
99 { COMMON_SOCK_PERMS
, NULL
} },
101 { COMMON_SOCK_PERMS
, NULL
} },
102 { "unix_stream_socket",
103 { COMMON_SOCK_PERMS
, "connectto", NULL
} },
104 { "unix_dgram_socket",
105 { COMMON_SOCK_PERMS
, NULL
} },
107 { COMMON_IPC_PERMS
, NULL
} },
108 { "msg", { "send", "receive", NULL
} },
110 { COMMON_IPC_PERMS
, "enqueue", NULL
} },
112 { COMMON_IPC_PERMS
, "lock", NULL
} },
114 { COMMON_IPC_PERMS
, NULL
} },
115 { "netlink_route_socket",
117 "nlmsg_read", "nlmsg_write", NULL
} },
118 { "netlink_tcpdiag_socket",
120 "nlmsg_read", "nlmsg_write", NULL
} },
121 { "netlink_nflog_socket",
122 { COMMON_SOCK_PERMS
, NULL
} },
123 { "netlink_xfrm_socket",
125 "nlmsg_read", "nlmsg_write", NULL
} },
126 { "netlink_selinux_socket",
127 { COMMON_SOCK_PERMS
, NULL
} },
128 { "netlink_iscsi_socket",
129 { COMMON_SOCK_PERMS
, NULL
} },
130 { "netlink_audit_socket",
132 "nlmsg_read", "nlmsg_write", "nlmsg_relay", "nlmsg_readpriv",
133 "nlmsg_tty_audit", NULL
} },
134 { "netlink_fib_lookup_socket",
135 { COMMON_SOCK_PERMS
, NULL
} },
136 { "netlink_connector_socket",
137 { COMMON_SOCK_PERMS
, NULL
} },
138 { "netlink_netfilter_socket",
139 { COMMON_SOCK_PERMS
, NULL
} },
140 { "netlink_dnrt_socket",
141 { COMMON_SOCK_PERMS
, NULL
} },
143 { "sendto", "recvfrom", "setcontext", "polmatch", NULL
} },
144 { "netlink_kobject_uevent_socket",
145 { COMMON_SOCK_PERMS
, NULL
} },
146 { "netlink_generic_socket",
147 { COMMON_SOCK_PERMS
, NULL
} },
148 { "netlink_scsitransport_socket",
149 { COMMON_SOCK_PERMS
, NULL
} },
150 { "netlink_rdma_socket",
151 { COMMON_SOCK_PERMS
, NULL
} },
152 { "netlink_crypto_socket",
153 { COMMON_SOCK_PERMS
, NULL
} },
154 { "appletalk_socket",
155 { COMMON_SOCK_PERMS
, NULL
} },
157 { "send", "recv", "relabelto", "forward_in", "forward_out", NULL
} },
159 { "view", "read", "write", "search", "link", "setattr", "create",
163 "node_bind", "name_connect", NULL
} },
164 { "memprotect", { "mmap_zero", NULL
} },
165 { "peer", { "recv", NULL
} },
167 { COMMON_CAP2_PERMS
, NULL
} },
168 { "kernel_service", { "use_as_override", "create_files_as", NULL
} },
170 { COMMON_SOCK_PERMS
, "attach_queue", NULL
} },
171 { "binder", { "impersonate", "call", "set_context_mgr", "transfer",
174 { COMMON_CAP_PERMS
, NULL
} },
176 { COMMON_CAP2_PERMS
, NULL
} },
179 "node_bind", NULL
} },
182 "node_bind", NULL
} },
184 { COMMON_SOCK_PERMS
, NULL
} },
186 { COMMON_SOCK_PERMS
, NULL
} },
188 { COMMON_SOCK_PERMS
, NULL
} },
190 { COMMON_SOCK_PERMS
, NULL
} },
192 { COMMON_SOCK_PERMS
, NULL
} },
194 { COMMON_SOCK_PERMS
, NULL
} },
196 { COMMON_SOCK_PERMS
, NULL
} },
198 { COMMON_SOCK_PERMS
, NULL
} },
200 { COMMON_SOCK_PERMS
, NULL
} },
202 { COMMON_SOCK_PERMS
, NULL
} },
204 { COMMON_SOCK_PERMS
, NULL
} },
206 { COMMON_SOCK_PERMS
, NULL
} },
208 { COMMON_SOCK_PERMS
, NULL
} },
210 { COMMON_SOCK_PERMS
, NULL
} },
211 { "bluetooth_socket",
212 { COMMON_SOCK_PERMS
, NULL
} },
214 { COMMON_SOCK_PERMS
, NULL
} },
216 { COMMON_SOCK_PERMS
, NULL
} },
218 { COMMON_SOCK_PERMS
, NULL
} },
220 { COMMON_SOCK_PERMS
, NULL
} },
221 { "ieee802154_socket",
222 { COMMON_SOCK_PERMS
, NULL
} },
224 { COMMON_SOCK_PERMS
, NULL
} },
226 { COMMON_SOCK_PERMS
, NULL
} },
228 { COMMON_SOCK_PERMS
, NULL
} },
230 { COMMON_SOCK_PERMS
, NULL
} },
232 { COMMON_SOCK_PERMS
, NULL
} },
234 { COMMON_SOCK_PERMS
, NULL
} },
236 { COMMON_SOCK_PERMS
, NULL
} },
238 { "access", NULL
} },
239 { "infiniband_endport",
240 { "manage_subnet", NULL
} },
242 {"map_create", "map_read", "map_write", "prog_load", "prog_run"} },
247 #error New address family defined, please update secclass_map.