security/selinux/include/classmap.h

Source file repositories/reference/linux-study-clean/security/selinux/include/classmap.h

File Facts

System
Linux kernel
Corpus path
security/selinux/include/classmap.h
Extension
.h
Size
8981 bytes
Lines
194
Domain
Core OS
Bucket
Security And Isolation
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

#define COMMON_FILE_SOCK_PERMS                                            \
	"ioctl", "read", "write", "create", "getattr", "setattr", "lock", \
		"relabelfrom", "relabelto", "append", "map"

#define COMMON_FILE_PERMS                                                \
	COMMON_FILE_SOCK_PERMS, "unlink", "link", "rename", "execute",   \
		"quotaon", "mounton", "audit_access", "open", "execmod", \
		"watch", "watch_mount", "watch_sb", "watch_with_perm",   \
		"watch_reads", "watch_mountns"

#define COMMON_SOCK_PERMS                                              \
	COMMON_FILE_SOCK_PERMS, "bind", "connect", "listen", "accept", \
		"getopt", "setopt", "shutdown", "recvfrom", "sendto",  \
		"name_bind"

#define COMMON_IPC_PERMS                                            \
	"create", "destroy", "getattr", "setattr", "read", "write", \
		"associate", "unix_read", "unix_write"

#define COMMON_CAP_PERMS                                                     \
	"chown", "dac_override", "dac_read_search", "fowner", "fsetid",      \
		"kill", "setgid", "setuid", "setpcap", "linux_immutable",    \
		"net_bind_service", "net_broadcast", "net_admin", "net_raw", \
		"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_tty_config", "mknod", "lease", "audit_write",           \
		"audit_control", "setfcap"

#define COMMON_CAP2_PERMS                                                     \
	"mac_override", "mac_admin", "syslog", "wake_alarm", "block_suspend", \
		"audit_read", "perfmon", "bpf", "checkpoint_restore"

#ifdef __KERNEL__ /* avoid this check when building host programs */
#include <linux/capability.h>

#if CAP_LAST_CAP > CAP_CHECKPOINT_RESTORE
#error New capability defined, please update COMMON_CAP2_PERMS.
#endif
#endif

/*
 * Note: The name for any socket class should be suffixed by "socket",
 *	 and doesn't contain more than one substr of "socket".
 */
const struct security_class_mapping secclass_map[] = {
	{ "security",
	  { "compute_av", "compute_create", "compute_member", "check_context",
	    "load_policy", "compute_relabel", "compute_user", "setenforce",
	    "setbool", "setsecparam", "setcheckreqprot", "read_policy",
	    "validate_trans", NULL } },
	{ "process",
	  { "fork",	    "transition",    "sigchld",	    "sigkill",
	    "sigstop",	    "signull",	     "signal",	    "ptrace",
	    "getsched",	    "setsched",	     "getsession",  "getpgid",
	    "setpgid",	    "getcap",	     "setcap",	    "share",
	    "getattr",	    "setexec",	     "setfscreate", "noatsecure",
	    "siginh",	    "setrlimit",     "rlimitinh",   "dyntransition",
	    "setcurrent",   "execmem",	     "execstack",   "execheap",
	    "setkeycreate", "setsockcreate", "getrlimit",   NULL } },
	{ "process2", { "nnp_transition", "nosuid_transition", NULL } },
	{ "system",
	  { "ipc_info", "syslog_read", "syslog_mod", "syslog_console",
	    "module_request", "module_load", "firmware_load",
	    "kexec_image_load", "kexec_initramfs_load", "policy_load",
	    "x509_certificate_load", NULL } },
	{ "capability", { COMMON_CAP_PERMS, NULL } },
	{ "filesystem",
	  { "mount", "remount", "unmount", "getattr", "relabelfrom",
	    "relabelto", "associate", "quotamod", "quotaget", "watch", NULL } },
	{ "file",
	  { COMMON_FILE_PERMS, "execute_no_trans", "entrypoint", NULL } },
	{ "dir",
	  { COMMON_FILE_PERMS, "add_name", "remove_name", "reparent", "search",
	    "rmdir", NULL } },
	{ "fd", { "use", NULL } },
	{ "lnk_file", { COMMON_FILE_PERMS, NULL } },
	{ "chr_file", { COMMON_FILE_PERMS, NULL } },
	{ "blk_file", { COMMON_FILE_PERMS, NULL } },
	{ "sock_file", { COMMON_FILE_PERMS, NULL } },
	{ "fifo_file", { COMMON_FILE_PERMS, NULL } },
	{ "socket", { COMMON_SOCK_PERMS, NULL } },
	{ "tcp_socket",
	  { COMMON_SOCK_PERMS, "node_bind", "name_connect", NULL } },
	{ "udp_socket", { COMMON_SOCK_PERMS, "node_bind", NULL } },
	{ "rawip_socket", { COMMON_SOCK_PERMS, "node_bind", NULL } },
	{ "node", { "recvfrom", "sendto", NULL } },
	{ "netif", { "ingress", "egress", NULL } },
	{ "netlink_socket", { COMMON_SOCK_PERMS, NULL } },
	{ "packet_socket", { COMMON_SOCK_PERMS, NULL } },

Annotation

Implementation Notes