Commit 27283b31 authored by Paul Moore's avatar Paul Moore

selinux: fix style issues in security/selinux/include/classmap.h

As part of on ongoing effort to perform more automated testing and
provide more tools for individual developers to validate their
patches before submitting, we are trying to make our code
"clang-format clean".  My hope is that once we have fixed all of our
style "quirks", developers will be able to run clang-format on their
patches to help avoid silly formatting problems and ensure their
changes fit in well with the rest of the SELinux kernel code.
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent 1d08fa8b
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/socket.h> #include <linux/socket.h>
#define COMMON_FILE_SOCK_PERMS "ioctl", "read", "write", "create", \ #define COMMON_FILE_SOCK_PERMS \
"getattr", "setattr", "lock", "relabelfrom", "relabelto", "append", "map" "ioctl", "read", "write", "create", "getattr", "setattr", "lock", \
"relabelfrom", "relabelto", "append", "map"
#define COMMON_FILE_PERMS COMMON_FILE_SOCK_PERMS, "unlink", "link", \ #define COMMON_FILE_PERMS \
"rename", "execute", "quotaon", "mounton", "audit_access", \ COMMON_FILE_SOCK_PERMS, "unlink", "link", "rename", "execute", \
"open", "execmod", "watch", "watch_mount", "watch_sb", \ "quotaon", "mounton", "audit_access", "open", "execmod", \
"watch_with_perm", "watch_reads" "watch", "watch_mount", "watch_sb", "watch_with_perm", \
"watch_reads"
#define COMMON_SOCK_PERMS COMMON_FILE_SOCK_PERMS, "bind", "connect", \ #define COMMON_SOCK_PERMS \
"listen", "accept", "getopt", "setopt", "shutdown", "recvfrom", \ COMMON_FILE_SOCK_PERMS, "bind", "connect", "listen", "accept", \
"sendto", "name_bind" "getopt", "setopt", "shutdown", "recvfrom", "sendto", \
"name_bind"
#define COMMON_IPC_PERMS "create", "destroy", "getattr", "setattr", "read", \ #define COMMON_IPC_PERMS \
"write", "associate", "unix_read", "unix_write" "create", "destroy", "getattr", "setattr", "read", "write", \
"associate", "unix_read", "unix_write"
#define COMMON_CAP_PERMS "chown", "dac_override", "dac_read_search", \ #define COMMON_CAP_PERMS \
"fowner", "fsetid", "kill", "setgid", "setuid", "setpcap", \ "chown", "dac_override", "dac_read_search", "fowner", "fsetid", \
"linux_immutable", "net_bind_service", "net_broadcast", \ "kill", "setgid", "setuid", "setpcap", "linux_immutable", \
"net_admin", "net_raw", "ipc_lock", "ipc_owner", "sys_module", \ "net_bind_service", "net_broadcast", "net_admin", "net_raw", \
"sys_rawio", "sys_chroot", "sys_ptrace", "sys_pacct", "sys_admin", \ "ipc_lock", "ipc_owner", "sys_module", "sys_rawio", \
"sys_chroot", "sys_ptrace", "sys_pacct", "sys_admin", \
"sys_boot", "sys_nice", "sys_resource", "sys_time", \ "sys_boot", "sys_nice", "sys_resource", "sys_time", \
"sys_tty_config", "mknod", "lease", "audit_write", \ "sys_tty_config", "mknod", "lease", "audit_write", \
"audit_control", "setfcap" "audit_control", "setfcap"
#define COMMON_CAP2_PERMS "mac_override", "mac_admin", "syslog", \ #define COMMON_CAP2_PERMS \
"wake_alarm", "block_suspend", "audit_read", "perfmon", "bpf", \ "mac_override", "mac_admin", "syslog", "wake_alarm", "block_suspend", \
"checkpoint_restore" "audit_read", "perfmon", "bpf", "checkpoint_restore"
#if CAP_LAST_CAP > CAP_CHECKPOINT_RESTORE #if CAP_LAST_CAP > CAP_CHECKPOINT_RESTORE
#error New capability defined, please update COMMON_CAP2_PERMS. #error New capability defined, please update COMMON_CAP2_PERMS.
...@@ -40,224 +46,140 @@ ...@@ -40,224 +46,140 @@
*/ */
const struct security_class_mapping secclass_map[] = { const struct security_class_mapping secclass_map[] = {
{ "security", { "security",
{ "compute_av", "compute_create", "compute_member", { "compute_av", "compute_create", "compute_member", "check_context",
"check_context", "load_policy", "compute_relabel", "load_policy", "compute_relabel", "compute_user", "setenforce",
"compute_user", "setenforce", "setbool", "setsecparam", "setbool", "setsecparam", "setcheckreqprot", "read_policy",
"setcheckreqprot", "read_policy", "validate_trans", NULL } }, "validate_trans", NULL } },
{ "process", { "process",
{ "fork", "transition", "sigchld", "sigkill", { "fork", "transition", "sigchld", "sigkill",
"sigstop", "signull", "signal", "ptrace", "getsched", "setsched", "sigstop", "signull", "signal", "ptrace",
"getsession", "getpgid", "setpgid", "getcap", "setcap", "share", "getsched", "setsched", "getsession", "getpgid",
"getattr", "setexec", "setfscreate", "noatsecure", "siginh", "setpgid", "getcap", "setcap", "share",
"setrlimit", "rlimitinh", "dyntransition", "setcurrent", "getattr", "setexec", "setfscreate", "noatsecure",
"execmem", "execstack", "execheap", "setkeycreate", "siginh", "setrlimit", "rlimitinh", "dyntransition",
"setsockcreate", "getrlimit", NULL } }, "setcurrent", "execmem", "execstack", "execheap",
{ "process2", "setkeycreate", "setsockcreate", "getrlimit", NULL } },
{ "nnp_transition", "nosuid_transition", NULL } }, { "process2", { "nnp_transition", "nosuid_transition", NULL } },
{ "system", { "system",
{ "ipc_info", "syslog_read", "syslog_mod", { "ipc_info", "syslog_read", "syslog_mod", "syslog_console",
"syslog_console", "module_request", "module_load", NULL } }, "module_request", "module_load", NULL } },
{ "capability", { "capability", { COMMON_CAP_PERMS, NULL } },
{ COMMON_CAP_PERMS, NULL } },
{ "filesystem", { "filesystem",
{ "mount", "remount", "unmount", "getattr", { "mount", "remount", "unmount", "getattr", "relabelfrom",
"relabelfrom", "relabelto", "associate", "quotamod", "relabelto", "associate", "quotamod", "quotaget", "watch", NULL } },
"quotaget", "watch", NULL } },
{ "file", { "file",
{ COMMON_FILE_PERMS, { COMMON_FILE_PERMS, "execute_no_trans", "entrypoint", NULL } },
"execute_no_trans", "entrypoint", NULL } },
{ "dir", { "dir",
{ COMMON_FILE_PERMS, "add_name", "remove_name", { COMMON_FILE_PERMS, "add_name", "remove_name", "reparent", "search",
"reparent", "search", "rmdir", NULL } }, "rmdir", NULL } },
{ "fd", { "use", NULL } }, { "fd", { "use", NULL } },
{ "lnk_file", { "lnk_file", { COMMON_FILE_PERMS, NULL } },
{ COMMON_FILE_PERMS, NULL } }, { "chr_file", { COMMON_FILE_PERMS, NULL } },
{ "chr_file", { "blk_file", { COMMON_FILE_PERMS, NULL } },
{ COMMON_FILE_PERMS, NULL } }, { "sock_file", { COMMON_FILE_PERMS, NULL } },
{ "blk_file", { "fifo_file", { COMMON_FILE_PERMS, NULL } },
{ COMMON_FILE_PERMS, NULL } }, { "socket", { COMMON_SOCK_PERMS, NULL } },
{ "sock_file",
{ COMMON_FILE_PERMS, NULL } },
{ "fifo_file",
{ COMMON_FILE_PERMS, NULL } },
{ "socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "tcp_socket", { "tcp_socket",
{ COMMON_SOCK_PERMS, { COMMON_SOCK_PERMS, "node_bind", "name_connect", NULL } },
"node_bind", "name_connect", { "udp_socket", { COMMON_SOCK_PERMS, "node_bind", NULL } },
NULL } }, { "rawip_socket", { COMMON_SOCK_PERMS, "node_bind", NULL } },
{ "udp_socket", { "node", { "recvfrom", "sendto", NULL } },
{ COMMON_SOCK_PERMS, { "netif", { "ingress", "egress", NULL } },
"node_bind", NULL } }, { "netlink_socket", { COMMON_SOCK_PERMS, NULL } },
{ "rawip_socket", { "packet_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, { "key_socket", { COMMON_SOCK_PERMS, NULL } },
"node_bind", NULL } }, { "unix_stream_socket", { COMMON_SOCK_PERMS, "connectto", NULL } },
{ "node", { "unix_dgram_socket", { COMMON_SOCK_PERMS, NULL } },
{ "recvfrom", "sendto", NULL } }, { "sem", { COMMON_IPC_PERMS, NULL } },
{ "netif",
{ "ingress", "egress", NULL } },
{ "netlink_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "packet_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "key_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "unix_stream_socket",
{ COMMON_SOCK_PERMS, "connectto", NULL } },
{ "unix_dgram_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "sem",
{ COMMON_IPC_PERMS, NULL } },
{ "msg", { "send", "receive", NULL } }, { "msg", { "send", "receive", NULL } },
{ "msgq", { "msgq", { COMMON_IPC_PERMS, "enqueue", NULL } },
{ COMMON_IPC_PERMS, "enqueue", NULL } }, { "shm", { COMMON_IPC_PERMS, "lock", NULL } },
{ "shm", { "ipc", { COMMON_IPC_PERMS, NULL } },
{ COMMON_IPC_PERMS, "lock", NULL } },
{ "ipc",
{ COMMON_IPC_PERMS, NULL } },
{ "netlink_route_socket", { "netlink_route_socket",
{ COMMON_SOCK_PERMS, { COMMON_SOCK_PERMS, "nlmsg_read", "nlmsg_write", NULL } },
"nlmsg_read", "nlmsg_write", NULL } },
{ "netlink_tcpdiag_socket", { "netlink_tcpdiag_socket",
{ COMMON_SOCK_PERMS, { COMMON_SOCK_PERMS, "nlmsg_read", "nlmsg_write", NULL } },
"nlmsg_read", "nlmsg_write", NULL } }, { "netlink_nflog_socket", { COMMON_SOCK_PERMS, NULL } },
{ "netlink_nflog_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "netlink_xfrm_socket", { "netlink_xfrm_socket",
{ COMMON_SOCK_PERMS, { COMMON_SOCK_PERMS, "nlmsg_read", "nlmsg_write", NULL } },
"nlmsg_read", "nlmsg_write", NULL } }, { "netlink_selinux_socket", { COMMON_SOCK_PERMS, NULL } },
{ "netlink_selinux_socket", { "netlink_iscsi_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } },
{ "netlink_iscsi_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "netlink_audit_socket", { "netlink_audit_socket",
{ COMMON_SOCK_PERMS, { COMMON_SOCK_PERMS, "nlmsg_read", "nlmsg_write", "nlmsg_relay",
"nlmsg_read", "nlmsg_write", "nlmsg_relay", "nlmsg_readpriv", "nlmsg_readpriv", "nlmsg_tty_audit", NULL } },
"nlmsg_tty_audit", NULL } }, { "netlink_fib_lookup_socket", { COMMON_SOCK_PERMS, NULL } },
{ "netlink_fib_lookup_socket", { "netlink_connector_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "netlink_netfilter_socket", { COMMON_SOCK_PERMS, NULL } },
{ "netlink_connector_socket", { "netlink_dnrt_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } },
{ "netlink_netfilter_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "netlink_dnrt_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "association", { "association",
{ "sendto", "recvfrom", "setcontext", "polmatch", NULL } }, { "sendto", "recvfrom", "setcontext", "polmatch", NULL } },
{ "netlink_kobject_uevent_socket", { "netlink_kobject_uevent_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "netlink_generic_socket", { COMMON_SOCK_PERMS, NULL } },
{ "netlink_generic_socket", { "netlink_scsitransport_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "netlink_rdma_socket", { COMMON_SOCK_PERMS, NULL } },
{ "netlink_scsitransport_socket", { "netlink_crypto_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "appletalk_socket", { COMMON_SOCK_PERMS, NULL } },
{ "netlink_rdma_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "netlink_crypto_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "appletalk_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "packet", { "packet",
{ "send", "recv", "relabelto", "forward_in", "forward_out", NULL } }, { "send", "recv", "relabelto", "forward_in", "forward_out", NULL } },
{ "key", { "key",
{ "view", "read", "write", "search", "link", "setattr", "create", { "view", "read", "write", "search", "link", "setattr", "create",
NULL } }, NULL } },
{ "dccp_socket", { "dccp_socket",
{ COMMON_SOCK_PERMS, { COMMON_SOCK_PERMS, "node_bind", "name_connect", NULL } },
"node_bind", "name_connect", NULL } },
{ "memprotect", { "mmap_zero", NULL } }, { "memprotect", { "mmap_zero", NULL } },
{ "peer", { "recv", NULL } }, { "peer", { "recv", NULL } },
{ "capability2", { "capability2", { COMMON_CAP2_PERMS, NULL } },
{ COMMON_CAP2_PERMS, NULL } },
{ "kernel_service", { "use_as_override", "create_files_as", NULL } }, { "kernel_service", { "use_as_override", "create_files_as", NULL } },
{ "tun_socket", { "tun_socket", { COMMON_SOCK_PERMS, "attach_queue", NULL } },
{ COMMON_SOCK_PERMS, "attach_queue", NULL } }, { "binder",
{ "binder", { "impersonate", "call", "set_context_mgr", "transfer", { "impersonate", "call", "set_context_mgr", "transfer", NULL } },
NULL } }, { "cap_userns", { COMMON_CAP_PERMS, NULL } },
{ "cap_userns", { "cap2_userns", { COMMON_CAP2_PERMS, NULL } },
{ COMMON_CAP_PERMS, NULL } },
{ "cap2_userns",
{ COMMON_CAP2_PERMS, NULL } },
{ "sctp_socket", { "sctp_socket",
{ COMMON_SOCK_PERMS, { COMMON_SOCK_PERMS, "node_bind", "name_connect", "association",
"node_bind", "name_connect", "association", NULL } }, NULL } },
{ "icmp_socket", { "icmp_socket", { COMMON_SOCK_PERMS, "node_bind", NULL } },
{ COMMON_SOCK_PERMS, { "ax25_socket", { COMMON_SOCK_PERMS, NULL } },
"node_bind", NULL } }, { "ipx_socket", { COMMON_SOCK_PERMS, NULL } },
{ "ax25_socket", { "netrom_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "atmpvc_socket", { COMMON_SOCK_PERMS, NULL } },
{ "ipx_socket", { "x25_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "rose_socket", { COMMON_SOCK_PERMS, NULL } },
{ "netrom_socket", { "decnet_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "atmsvc_socket", { COMMON_SOCK_PERMS, NULL } },
{ "atmpvc_socket", { "rds_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "irda_socket", { COMMON_SOCK_PERMS, NULL } },
{ "x25_socket", { "pppox_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "llc_socket", { COMMON_SOCK_PERMS, NULL } },
{ "rose_socket", { "can_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "tipc_socket", { COMMON_SOCK_PERMS, NULL } },
{ "decnet_socket", { "bluetooth_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "iucv_socket", { COMMON_SOCK_PERMS, NULL } },
{ "atmsvc_socket", { "rxrpc_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "isdn_socket", { COMMON_SOCK_PERMS, NULL } },
{ "rds_socket", { "phonet_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "ieee802154_socket", { COMMON_SOCK_PERMS, NULL } },
{ "irda_socket", { "caif_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "alg_socket", { COMMON_SOCK_PERMS, NULL } },
{ "pppox_socket", { "nfc_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "vsock_socket", { COMMON_SOCK_PERMS, NULL } },
{ "llc_socket", { "kcm_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "qipcrtr_socket", { COMMON_SOCK_PERMS, NULL } },
{ "can_socket", { "smc_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "infiniband_pkey", { "access", NULL } },
{ "tipc_socket", { "infiniband_endport", { "manage_subnet", NULL } },
{ COMMON_SOCK_PERMS, NULL } },
{ "bluetooth_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "iucv_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "rxrpc_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "isdn_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "phonet_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "ieee802154_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "caif_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "alg_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "nfc_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "vsock_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "kcm_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "qipcrtr_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "smc_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "infiniband_pkey",
{ "access", NULL } },
{ "infiniband_endport",
{ "manage_subnet", NULL } },
{ "bpf", { "bpf",
{ "map_create", "map_read", "map_write", "prog_load", "prog_run", { "map_create", "map_read", "map_write", "prog_load", "prog_run",
NULL } }, NULL } },
{ "xdp_socket", { "xdp_socket", { COMMON_SOCK_PERMS, NULL } },
{ COMMON_SOCK_PERMS, NULL } }, { "mctp_socket", { COMMON_SOCK_PERMS, NULL } },
{ "mctp_socket",
{ COMMON_SOCK_PERMS, NULL } },
{ "perf_event", { "perf_event",
{ "open", "cpu", "kernel", "tracepoint", "read", "write", NULL } }, { "open", "cpu", "kernel", "tracepoint", "read", "write", NULL } },
{ "anon_inode", { "anon_inode", { COMMON_FILE_PERMS, NULL } },
{ COMMON_FILE_PERMS, NULL } }, { "io_uring", { "override_creds", "sqpoll", "cmd", NULL } },
{ "io_uring", { "user_namespace", { "create", NULL } },
{ "override_creds", "sqpoll", "cmd", NULL } },
{ "user_namespace",
{ "create", NULL } },
{ NULL } { NULL }
}; };
#if PF_MAX > 46 #if PF_MAX > 46
#error New address family defined, please update secclass_map. #error New address family defined, please update secclass_map.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment